|
enum PointContourStatus {
OutsideContour = -1,
OnContour = 0,
InsideContour = 1,
InternalError = -99
};
PointContourStatus is采用point采用in采用curve(AcGePoint3d p, AcGePoint2dArray &pts, AcGeDoubleArray &blgs)
{
AcDbMPolygon mpol;
if (mpol.appendMPolygonLoop(pts,blgs) != Acad::eOk) return InternalError;
AcGeIntArray ar;
if (mpol.isPointOnLoopBoundary(p,0)) return OnContour;
if (mpol.isPointInsideMPolygon(p,ar) > 0) return InsideContour;
else return OutsideContour;
}
PointContourStatus is采用point采用in采用curve(AcGePoint3d p, AcDbCurve *pCurv)
{
double fuzz = AcGeContext::gTol.equalPoint();
AcGePoint3d pointOnCurve;
pCurv->getClosestPointTo(p,pointOnCurve);
if (p.distanceTo(pointOnCurve) <= fuzz) return OnContour;
AcDbPolyline *pPoly = AcDbPolyline::cast(pCurv);
AcDb2dPolyline *p2Poly = AcDb2dPolyline::cast(pCurv);
AcDbCircle *pCircle = AcDbCircle::cast(pCurv);
AcDbMPolygon mpol;
if (pPoly) {
if (mpol.appendLoopFromBoundary(pPoly) != Acad::eOk) return InternalError;
} else if (p2Poly) {
if (mpol.appendLoopFromBoundary(p2Poly) != Acad::eOk) return InternalError;
} else if (pCircle) {
if (mpol.appendLoopFromBoundary(pCircle) != Acad::eOk) return InternalError;
} else return InternalError;
AcGeIntArray ar;
if (mpol.isPointInsideMPolygon(p,ar) > 0) return InsideContour;
else return OutsideContour;
} |
|