OCC求交工具:
(1)二维曲线求交:Geom2dAPI_InterCurveCurve
(2)三维曲线与曲面求交:GeomAPI_IntCS
(3)三维曲面与曲面求交:GeomAPI_IntSS
(4)三维曲线求交:(这里有点不太懂)通过GeomAPI_ExtremaCurveCurve用于两条曲线求机制,可用于三维曲线的求交
接口使用:
//求交
//以二维曲线求交为例
Handle(Geom2d_Line) l1 = new Geom2d_Line(gp_Pnt2d(0, 0), gp_Dir2d(1, 0));
Handle(Geom2d_Circle) l2 = new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(0, 0), gp_Dir2d(0, 1)),5.0);
Geom2dAPI_InterCurveCurve intersector(l1, l2, Precision::Confusion());
for (int i = 1; i <= intersector.NbPoints(); i++) {
gp_Pnt2d interPoint = intersector.Point(i);
cout << "交点" << i << "为:(" << interPoint.X() << "," << interPoint.Y() << ")" << endl;
}