已知四个点ABPQ,求Q点在ABP平面的投影点。如果已经共面了,投影点和Q重合

投影点设为M,则有向量QM,ABP的法向 和QM是平行的。

平面的方程为 Ax+By+Cz+D=0;

cpp 复制代码
    //* \author  PangYeYi
  //   *  \return Q2 在 P1 P2 Q1 构成的平面的上的投影点
  //   ******************/
    Point3d VEC3::GetProPointOn_Face(const Point3d& P1, const Point3d& P2, const Point3d& Q1, const Point3d& Q2)
    {

        UGAPI::StrPoint P(P1);
        UGAPI::StrPoint Q(P2);
        UGAPI::StrPoint A(Q1);
        UGAPI::StrPoint B(Q2);
        UGAPI::StrPoint PQ = Q - P;
        UGAPI::StrPoint PA = A - P;
        UGAPI::StrPoint normal = PQ.cross(PA);// 法向 叉乘 

      
   
        double D = 0;
        if (normal.point[0] == 0 && normal.point[1] == 0 && normal.point[2] == 0)//平行
        {
            return Point3d(0, 0, 0);

        }
        else
        {    //平面方程  Ax+By+Cz+D=0;  A  B  C 为法向 
            D = (normal.point[0] * P1.X + normal.point[1] * P1.Y + normal.point[2] * P1.Z) * (-1);
        }

     
        double t = normal.point[0] * Q2.X + normal.point[1] * Q2.Y + normal.point[2] * Q2.Z + D;

        //平面法向量 normal 的模长的平方
        double T = normal.point[0] * normal.point[0] + normal.point[1] * normal.point[1] + normal.point[2] * normal.point[2];
      
        UGAPI::StrPoint  res = B + normal * ((-t) / T);// 比例

        return res.ToPoint3d();
    }
相关推荐
zl_vslam14 小时前
SLAM中的非线性优-3D图优化之地平面约束(十四)
算法·计算机视觉·平面·3d
科士威传动10 天前
滚珠导轨平行度与平面度的精准保障方法
人工智能·科技·平面·机器人·自动化·制造
Venus-ww11 天前
平面三轴机器人的阻尼最小二乘法(DLS)逆运动学求解
平面·机器人·最小二乘法
啊西:11 天前
SuperMap iClient3D for WebGL平面场景实现绘制任意面进行GPU空间查询
平面·3d·webgl
Ccjf酷儿12 天前
计算机网络 (郑烇) 5 网络层:控制平面
网络·计算机网络·平面
点云侠12 天前
基于选权迭代法的空间平面拟合
线性代数·算法·平面
Ccjf酷儿15 天前
计算机网络 (郑烇) 4 网络层:数据平面
网络·计算机网络·平面
徐行tag15 天前
平面运动模型下的特性及应用
数码相机·平面·slam
qq 87622396517 天前
双馈风电机组并网仿真建模及调频策略研究:四机两区域/三机九节点系统下的虚拟惯量+下垂控制/超速...
平面
老贾专利烩17 天前
美容颈椎枕专利拆解:倾斜平面角度与脸部提拉效果量化测试
平面