我有 4 个点,其中三个点组成两条线,如 V 或 < 或 >,你明白了,现在我在那个圆锥(V)中得到一个点,我可以得到从顶部到的距离左下角和右下角,但不是底部 pos 所在的位置。
也许这会有所帮助。
我有代码可以解决这个问题:
public float GetDist(Vector3f one, Vector3f two, Vector3f three, Vector3f p){
Vector3f one_to_point = new Vector3f(0,0,0);
Vector3f.sub(p,one,one_to_point); //Storing vector A->P
Vector3f one_to_two = new Vector3f(0,0,0);
Vector3f.sub(two, one, one_to_two); //Storing vector A->B
Vector3f one_to_three = new Vector3f(0,0,0);
Vector3f.sub(three, one, one_to_three); //Storing vector A->C
float q1 = Vector3f.dot(one_to_point, one_to_two) / one_to_two.lengthSquared(); // The normalized "distance" from a to b
float q2 = Vector3f.dot(one_to_point, one_to_three) / one_to_three.lengthSquared(); // The normalized "distance" from a to c
现在我已经知道 pos 向量在锥体中,那么我需要做什么才能获得图像中绿色圆圈的 pos 所示的 pos?