isInside Query for a closed AcGePolyline2d

isInside Query for a closed AcGePolyline2d

Anonymous
Not applicable
241 Views
2 Replies
Message 1 of 3

isInside Query for a closed AcGePolyline2d

Anonymous
Not applicable
Hi there,

I need to detect if a input point lies inside a closed AcGePolyline2d or
not, (like the AcGeCircArc2d::isInside function) but a dont find any similar
funktion in AcGeCircArc2d and its base-classes or I dont find it. Please
message me if you know how i can detect if a input point lies inside a
closed AcGePolyline2d.

Thank you !!

Jens
0 Likes
242 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Maybe you can draw a point entity and try to see if it is include in the
polygon (with SSGet for example), just get the pointlist of the polyline and
then :

// Select crossing entities
acedSSGet("_CP", pointlist, NULL, NULL, ssname);
or
// Select entities in polygonal window
acedSSGet("_WP", pointlist, NULL, NULL, ssname);
...
acutRelRb(pointlist);
// Test if the point is in the Selection set
if (acedSSMember(pt, ssname) == RTNORM) then
{
...
}

this is the simplest way i think ... if there is not function for it of
course 🙂


"Jens Scheffler" a écrit dans le message de news:
96C2E747DD1F6799265D7A27581DAAA2@in.WebX.maYIadrTaRb...
> Hi there,
>
> I need to detect if a input point lies inside a closed AcGePolyline2d or
> not, (like the AcGeCircArc2d::isInside function) but a dont find any
similar
> funktion in AcGeCircArc2d and its base-classes or I dont find it. Please
> message me if you know how i can detect if a input point lies inside a
> closed AcGePolyline2d.
>
> Thank you !!
>
> Jens
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
I believe the typical geometric way to do this is to count the number of
times a ray drawn from the point crosses the polygon. If the count is odd,
it is inside the polygon.

This is what I would start with -

bool isPointInside(AcDbPolyline* pPolyline, AcGePoint3d testPnt)
{
AcGePoint3dArray pnts;
AcDbRay ray;
ray.setBasePoint(testPnt);
if(Acad::eOk != pPolyline->intersectWith(&ray, AcDb::kOnBothOperands,
pnts))
return false;
return (pnts.length() % 2 != 0);
}

|
----+----------------------------------------------
| Byron Blattel
| CADwerx---Applications for AutoCAD
| Autodesk Registered Developer
| email: byron@cadwerx.net
| web site: http://www.cadwerx.net
|

"Jens Scheffler" wrote in message
news:96C2E747DD1F6799265D7A27581DAAA2@in.WebX.maYIadrTaRb...
> Hi there,
>
> I need to detect if a input point lies inside a closed AcGePolyline2d or
> not, (like the AcGeCircArc2d::isInside function) but a dont find any
similar
> funktion in AcGeCircArc2d and its base-classes or I dont find it. Please
> message me if you know how i can detect if a input point lies inside a
> closed AcGePolyline2d.
>
> Thank you !!
>
> Jens
>
>
0 Likes