The orientation of a surface partially determines its evaluated normal vectors. A parametric surface has two parameters, u and v, each representing the direction of the parametric lines on the surface. If you take the cross-product of the utangent vector and the v tangent vector at the same point, you obtain a vector that is normal to the surface. This vector is the natural normal of the surface at that point. You can reverse the orientation of a surface by calling the following function:
AcGeSurface& AcGeSurface::reverseNormal();
The surface evaluator returns either the natural normal or its inverse, depending on whether reverseNormal() has been called an even or odd number of times. The following function returns a value of TRUE if the orientation of the surface is opposite to the natural orientation:
Adesk::Boolean AcGeSurface::isNormalReversed() const;
This example constructs a circle and projects it onto the XY plane. The type of the projected entity is then checked to see what type of entity it was projected into:
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) ...
The following example constructs a NURBS curve and finds the closest point on the curve to the point p1. The closest point is returned as an AcGePointOnCurve3d object from which the coordinates and parameter value are obtained:
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();