赞
踩
bool isPointOnRegion(AcGePoint3d pt,AcDbObjectId regionId)
{
Acad::ErrorStatus es;
AcDbRegion* pRegion ;
es = acdbOpenObject( pRegion, regionId, AcDb::kForRead );
if( es ) return false;
//创建射线,根据射线与面域边线相交的点数为奇数就说明点在面域上的理论
AcDbRay* pRay = new AcDbRay ;
pRay->setBasePoint( pt );
pRay->setUnitDir( AcGeVector3d(1, 0, 0));
AcGePlane projPlane = AcGePlane(AcGePoint3d(0,0,0), AcGeVector3d(0,0,1));
AcGePoint3dArray ptArray;
es = pRegion->intersectWith( pRay, AcDb::kOnBothOperands,projPlane, ptArray,0,0 );//AcDb::kExtendArg
pRegion->close();
delete pRay;
if(es )
{
return false;
}
int iNum = ptArray.length();
if( (iNum%2 ) == 0 ) return false;
return true;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。