已知四个点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();
    }
相关推荐
ueotek5 天前
Ansys Speos丨平面 OLED 人眼视觉仿真分析
平面
mqiqe6 天前
LLM Gateway:企业级大模型应用的“统一控制平面”
平面·flask·gateway
weixin_446260856 天前
AtumAI:面向数据中心控制平面策略的规范化智能体生成框架
人工智能·平面
落苜蓿蓝10 天前
多张覆盖视场的平面棋盘图片; 、对每张图片用 OpenCV 的 findChessboardCorners 检测内角点并用 corn ...
数码相机·opencv·平面
梵构广告10 天前
平台怎么做品牌营销策划?—品牌营销
大数据·人工智能·平面·品牌策划
梵构广告11 天前
百货品牌营销策划书怎么写?
平面·产品运营·品牌策划
鲸大鱼的自我修养12 天前
LC谐振状态轨迹图,相平面分析
平面
不吃辣49025 天前
从0-1学习导航页面布局优化和搭建
ui·平面·前端框架
海清河宴1 个月前
平面直线和曲线以及空间曲线计算方法
平面
Σίσυφος19001 个月前
激光三角 光平面标定之后计算深度图
算法·平面