gpt4 book ai didi

algorithm - 最靠近 x,y 的直线上的点

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:46:00 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How can I tell if a point is nearby a certain line?

//Returns the point on the line traced from start to end which
//comes nearest to 500,000, 500,000. The points are scaled between
//1,000,000 and 0 from their original fp types.
Point closestToCentre(Point start, Point end);

有谁知道比单步遍历像素更快的方法吗?

请问有没有比我更机敏的人展示他们的数学和几何实力?

_______编辑___________

谢谢克里斯,这让我很困惑:

[x; -a/bx-c/b]=[0; -c/b]-1/b[-b;斧头。

现在我看到它只是将向量(主要是 y 分量)分成两部分,它们结合起来产生相同的结果。让旧的部分分数脑细胞兴奋一分钟然后:)

_______编辑_________

Jason Moore,感谢您的启发,这是我正在做的,图形化的,

64x64 square with 2 sample lines each passing edge to edge and missing the centre by some distance

我希望这更清楚。

____编辑________

所以我可以合理地期望与我的采样线成直角并从中心运行它但是如何判断它们何时接触?

enter image description here

我认为 Kris 的方程式页面是正确的选择。如果你们都告诉我这是一个两步过程。现在只是两个联立方程,所以我可能不需要 Kris 的推导。

____编辑_________

无论是好事还是坏事,我都不知道,但 stackoverflow 作为搜索引擎的魅力向我揭示了几种调查途径。主要是我喜欢这里的第一个解决方案: Shortest distance between a point and a line segment .

但为了向我自己证明这一点,我需要底部的 matti 解决方案的链接(但只有一个):

http://www.topcoder.com/tc?d1=tutorials&d2=geometry1&module=Static

推导是如此简单和优雅,连我都能理解!

给定http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com