表面的方向部分决定了其计算的法向量。参数化曲面有两个参数,每个参数表示曲面上参数化线的方向。如果取切向量和切向量在同一点的叉积,则会得到一个垂直于曲面的向量。此向量是该点表面的自然法线。可以通过调用以下函数来反转曲面的方向:uvuv AcGeSurface& AcGeSurface::reverseNormal(); 表面赋值器返回自然法线或其逆法线,具体取决于是否称为偶数次或奇数次。如果曲面的方向与自然方向相反,则以下函数返回值 TRUE:reverseNormal() Adesk::Boolean AcGeSurface::isNormalReversed() const; 本示例构造一个圆并将其投影到XY平面上。然后检查投影实体的类型,以查看投影到的实体类型: AcGePlane plane; // ConstructsXY-plane. AcGePoint3d p1(2,3,5); AcGeVector3d v1(1,1,1); AcGeCircArc3d circ (p1, v1, 2.0); AcGeEntity3d *projectedEntity = circ.project(plane,v1); if (projectedEntity->type() == AcGe::kEllipArc3d) ... else if (projectedEntity->type() == AcGe::kCircArc3d) ... else if (projectedEntity->type() == AcGe::kLineSeg3d) ... 下面的示例构造一条 NURBS 曲线,并查找曲线上离该点最近的点。最近的点作为对象返回,从中获取坐标和参数值:p1AcGePointOnCurve3d AcGeKnotVector knots; AcGePoint3dArray cntrlPnts, AcGePointOnCurve3d pntOnCrv; AcGePoint3d p1(1,3,2); knots.append (0.0); knots.append (0.0); knots.append (0.0); knots.append (0.0); knots.append (1.0); knots.append (1.0); knots.append (1.0); knots.append (1.0); cntrlPnts.append (AcGePoint3d(0,0,0)); cntrlPnts.append (AcGePoint3d(1,1,0)); cntrlPnts.append (AcGePoint3d(2,1,0)); cntrlPnts.append (AcGePoint3d(3,0,0)); AcGeNurbCurve3d nurb (3, knots, cntrlPnts); nurb.getClosestPointTo(p1,pntOnCrv); p2 = pntOnCrv.point(); double param = pntOnCrv.parameter(); |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:45
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.