how can i check to point it's inside or outside of a Polyline?

how can i check to point it's inside or outside of a Polyline?

Anonymous
Not applicable
533 Views
3 Replies
Message 1 of 4

how can i check to point it's inside or outside of a Polyline?

Anonymous
Not applicable
Hi there

i need to detect if a point lies inside a closed AcDbPolyline or not
but i dont find any similar function in AND and it's relations classes or I
don't find it.

please message me if you know how to detect if a input point lies inside a
closed AcDbPolyline

thanks for read

Honesty
0 Likes
534 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hi Honesty,

You can refer to DevNotes 2595 " Testing whether A Point lies inside a
curve"on the ADN website or the PointA Customization Channel Knowledge
Database.

Cheers,
Varadarajan

"honesty man" wrote in message
news:C5340EF9709867B5C8489519E5D74E8C@in.WebX.maYIadrTaRb...
> Hi there
>
> i need to detect if a point lies inside a closed AcDbPolyline or not
> but i dont find any similar function in AND and it's relations classes or
I
> don't find it.
>
> please message me if you know how to detect if a input point lies inside a
> closed AcDbPolyline
>
> thanks for read
>
> Honesty
>
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi,

I checked ADN network I registered etc... but I could not find the DevNotes 2595 or any other development notes.

Can you give the full link or any other link that I can use?

Thanks
0 Likes
Message 4 of 4

Anonymous
Not applicable
You need to use the AcDbMPolygon Class;

Also, you can use this url link to view the whole topic about how to
implement AcDbMPolygon for your case, including the help from the master
Alexander Rivilis.

http://www.theswamp.org/index.php?topic=9145.0


I went into that route some time ago, here is one function to find if one
poly is inside another poly:

static void LESQsomefunctions_PINP(void)
{
ads_name en;
AcGePoint3d p;
Acad::ErrorStatus es;
AcDbObjectId objId1, objId2;
AcDbCurve *pEnt = NULL;
if (acedEntSel("\nSelect first curve: ",en,asDblArray(p)) != RTNORM) return;

if (acdbGetObjectId(objId1,en) != Acad::eOk) return;
AcDbObjectPointer pCurv1(objId1,AcDb::kForRead);

if (acedEntSel("\nSelect second curve: ",en,asDblArray(p)) != RTNORM)
return;

if (acdbGetObjectId(objId2,en) != Acad::eOk) return;
AcDbObjectPointer pCurv2(objId2,AcDb::kForRead);

if ((pCurv1.openStatus() == Acad::eOk) &&
(pCurv2.openStatus() == Acad::eOk)) {

AcDbPolyline *pPoly1 = AcDbPolyline::cast(pCurv1.object());
AcDbPolyline *pPoly2 = AcDbPolyline::cast(pCurv2.object());

AcGePoint3dArray points;
es = pPoly1->intersectWith(pPoly2, AcDb::kOnBothOperands, points);
int len;
if ((es != Acad::eOk) || ((len = points.length()) == 0)) {

AcGePoint3d point;
double params;
unsigned int num = pPoly2->numVerts();

AcDbMPolygon mpol;
AcGeIntArray ar;

mpol.appendLoopFromBoundary(pPoly1,false);

long cont;
for (cont=0; cont < (num - 1); cont++) {
pPoly2->getPointAtParam((double)cont, point);
if (mpol.isPointInsideMPolygon(point, ar) > 0) {
acutPrintf("\nInside!");
} else {
acutPrintf("\nNOT Inside!");
}
}
} else {
acutPrintf("\nNOT Inside!");
}
}
}//end of command PINP
0 Likes