似乎there is no way to compute line line intersection using boost::geometry
,但我想知道在 C++ 中最常用的方法是什么?
我需要二维中两条无限直线的交集算法,如果速度更快,它可以是两个不同的函数,例如:
bool line_intersection(line,line);
point line_intersetion(line,line);
附言我真的尽量避免发明轮子,所以倾向于使用一些库。
最佳答案
我找到的用于查找直线交点的最佳算法位于:Real Time Collision Detection by Christer Ericson , 可以找到本书的拷贝 here .
从第 146 页开始的第 5 章描述了如何找到 3D 线的最近点,这也是 2D 线的交叉点......使用 C 中的示例代码。
注意:小心平行线,它们会导致被零除错误。
关于c++ - 计算直线交点 C++ 的最常用方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34391795/