I been thinking of using the AcDbMPolygon class and the isPointInsideMPolygon() to verify if a point is inside a lightweight polyline, but for some reason is not working for me.
For example, I do a selection set of polylines, and if I define an internal point, I want to get the polyline, where that internal point was made.
Here is a sample command:
static void LESQGBPoly17_GETPOLY(void)
{
ads_name sspol;
resbuf *rbFilter = acutBuildList(RTDXF0, _T("LWPOLYLINE"), RTNONE);
if (acedSSGet(NULL, NULL, NULL, rbFilter, sspol) != RTNORM)
{
acutRelRb(rbFilter); return;
}
acutRelRb(rbFilter);
long len = 0;
if ((acedSSLength(sspol, &len) != RTNORM) || (len == 0))
{
acedSSFree(sspol); return;
}
AcGePoint3d worldPt;
if (acedGetPoint(NULL,_T("\nPick internal point: "),asDblArray(worldPt)) != RTNORM) return;
for (int i=0; i<len; i++)
{
AcDbMPolygon mpol;
AcDbObjectId objId;
ads_name ename;
acedSSName(sspol, i, ename);
if (acdbGetObjectId(objId, ename) != Acad::eOk) return;
AcDbObjectPointer <AcDbPolyline> pPoly(objId, AcDb::kForWrite);//for write test to erase, or color change
if (pPoly.openStatus() == Acad::eOk)
{
acdbUcs2Wcs(asDblArray(worldPt),asDblArray(worldPt),false);
AcGeVector3d vDir = AcGeVector3d::kZAxis;
resbuf rb; acedGetVar(_T("viewdir"),&rb);
vDir = asVec3d(rb.resval.rpoint);
AcDb::Planarity plan_type;
AcGePlane plane;
pPoly->getPlane(plane,plan_type);
worldPt = worldPt.project(plane,vDir);
AcGeIntArray loopsArray; //loopsArray.setLogicalLength(0);
if (mpol.appendLoopFromBoundary(pPoly) == Acad::eOk)
{
if ( mpol.isPointInsideMPolygon(worldPt, loopsArray) > 0)
{
acutPrintf(_T("\nPoint inside..."));
pPoly.object()->setColorIndex(6);
}
}
}
}
acedSSFree(sspol);
}
But, if when I try to define an internal point in the magenta polyline in the attached drawing, it won't return true, unless I change the tolerance in isPointInsideMPolygon(worldPt, loopsArray,1.0) to add the 1.0 for example, it will return that the point is inside, but also, will get the other polylines in the selection(something I do not want). So now, I am all confused...

Anyone, have any experience using isPointInsideMPolygon() ? - I know Alexander Rivilis posted here the function is_point_in_curve(), but it also does the same results...
Thanks!