已知四个点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();
    }
相关推荐
普密斯科技3 天前
齿轮平面度与正反面智能检测方案:3D视觉技术破解精密制造品控难题
人工智能·计算机视觉·平面·3d·自动化·视觉检测
AI科技星7 天前
v=c 物理理论核心参数转换表达式大全
开发语言·线性代数·算法·数学建模·平面
AI科技星7 天前
张祥前统一场论中两个电荷定义的统一性解析
开发语言·线性代数·算法·数学建模·平面
Topplyz11 天前
电源平面与地平面的对比
平面
Evand J11 天前
【MATLAB例程】二维平面下的CV和CA模型,组成IMM的仿真,滤波使用粒子滤波PF,适用于非线性目标跟踪、定位等
matlab·平面·目标跟踪·pf·粒子滤波·imm·多模型
FlDmr4i2814 天前
Aspire 开发者控制平面 (DCP) 开源
平面·开源
AI科技星17 天前
万能学习方法论的理论建构与多领域适配性研究(乖乖数学)
人工智能·学习·算法·机器学习·平面·数据挖掘
AI科技星17 天前
光速螺旋量子几何统一场论:基于四维类时螺旋的物理现象统一推导
开发语言·线性代数·算法·数学建模·平面
AI科技星23 天前
光速螺旋量子几何统一场论——基于 v ≡ c 公理的四大基本力全维度求导证明与精准数值验证
c语言·开发语言·人工智能·算法·机器学习·平面
@猪大肠24 天前
SolidWorks2025 安装教程+附下载链接
平面·3d