找到非线性点的最简单方法



我在3d空间中有一行:(x1,y1,z1(,(x2,y2,z2(我需要在任何平面上找到保证不与这条线共线的任何点。找到这样一个点最简单的方法是什么?

您需要一些非共线向量来构建所需的点。

有一种方法可以得到垂直矢量:

make vector d = (x2-x1, y2-y1, z2-z1)
choose component with the largest magnitude (say dy)
and component with the second magnitude (say dx)
make the third (smallest) component zero
exchange two larger components and negate the largest one
p = (-dy, dx, 0)

它垂直于源一(注意点积为零p.dot.d==0(

将该向量添加到任何端点以获得非共线点。

最新更新