opencascade:计算点在平面的投影

#include 

//计算三维点到三维平面的投影
//成功:返回投影点
//失败: 返回(0, 0, 0)点
static  gp_Pnt   calculateOrthoProject(const TopoDS_Face& face, const gp_Pnt& p)
{
    gp_Pnt resultPt;
   // TopoDS_Face  face =  BRepBuilderAPI_MakeFace(plane);
    const Handle(Geom_Surface)& RefSurf = BRep_Tool::Surface(face);
    Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Tree;
    GeomAPI_ProjectPointOnSurf generator(p, RefSurf, Algo );
    if (generator.NbPoints() > 0)
    {
        resultPt = generator.NearestPoint();
    }
    return resultPt;
}

你可能感兴趣的:(opencascade:计算点在平面的投影)