The best way for finding the closest line segment to a point

℡╲_俬逩灬. 提交于 2019-12-09 06:28:48

问题


As can be seen in figure below, I have some lines (finite length) between any two joints (red points), such as the line between joints J1 and J2. I have also some points such as P1 and P2.

I have the coordinates of points and joints. So, it is possible to calculate the line equations (y=mx+b). So, it is possible to calculate the distance between a point to any line. So, the lowest distance gives me the closest line to the point.

Since there are a huge number of points in this problem, it takes a huge calculations. I am looking for an efficient and fast method for that.

Using the Barycentric coordinate system, I can find any point is surrounded with which lines. This trick will decrease the number of calculations. But, I am looking for more tricks to make it faster.


回答1:


A voronoi diagram can gives you fast lookup. I think you can use the red points for the voronoi diagram. IMO the closest line is the same like the closest point.




回答2:


You can't use Voronoi diagram for ending points of segments.



来源:https://stackoverflow.com/questions/24138386/the-best-way-for-finding-the-closest-line-segment-to-a-point

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!