3d 点到多段线段的距离算法
我有一条路径,由 n 个 3d 坐标组成,全部串联连接,可以在 此图。
我想找到我的点和多段线段之间的最短距离。我可以计算一个点到一条线段的距离,但我想为更复杂的路径执行此操作。
是否有一种算法不依赖于测试每个线段到点的距离并存储最小值?任何指向正确方向的指针都会很棒!
这是一个游戏项目,我想计算玩家与游戏中存在的河流的距离。河流将用多段线段表示。
谢谢
I have a path, made up of n 3d coordinates, all connected in series, which can be seen in this diagram.
I want to find the shortest distance between my point and the poly line segment. I can calculate the distance of a point from a single line segment, but I want to do it for a more complicated path.
Is there an algorithm for this that does not rely on testing every line segment to point distance and stores the minimum? Any pointers in the right direction would be great!
This is for a games project where I want to calculate the distance of the player from a river that exists in the game. The river will be represented with poly line segments.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
R3 3D 矢量代数 java 包的其余部分(自包含,无外部依赖项)位于此处:
https://gist.github.com/reciprocum/4e3599a9563ec83ba2a63f5a6cdd39eb
开源库的一部分
https://sourceforge.net/projects/geokarambola/
The rest of the (self contained, no external dependencies) R3 3D vector algebra java package is here:
https://gist.github.com/reciprocum/4e3599a9563ec83ba2a63f5a6cdd39eb
part of the open source library
https://sourceforge.net/projects/geokarambola/