I want to find the coordinate of a point (say P) which is away from a known distance (say d). the case is: I want the point that lie on a line (3d) which is perpendicular to the another given line segment (3d) and passing through the one end of that given line segment (say A). So, I know 2 end points (also vector along the line) of the given line segment and distance d and vector of the perpendicular line. Also point C where the perpendicular line pass through is also known. I am having
vector3
class and line3 class.
解决这个问题的方法很难弄清楚,所以请在这方面帮助我指点迷津。
是的,由于该线上有 2 个相反方向的点,我正在寻找更接近点 C(而不是 Q)的点 (P)。
提前谢谢
最佳答案
找到方向 vector ,然后将其乘以d
,然后添加到起点:
Vector A, C;
float d = 100;
Vector dir = C - A;
dir.normalize();
dir *= d;
Vector P = A + dir;
关于c++ - 找到与给定 3D 线正交的远离 d 距离的点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13604514/