Face with Holes

Hi All,

I have 2 2D points (or 3D points doesn't matter) and I need to know if there's a hole (or the face's boundaries) between these 2 points. My target is: to know if these 2 points can be connect by a line which complete belongs to the FACE.
Is there a effective way to do it?!

Regards,

Attachments: 
Cauchy Ding's picture

Hi Macedo,

I think you have to calculate intersection between the line(2d) and the hole curve(2d). Another stupid method is to tessellate the curve and test each point whether they locate in the face region. Such as,

bool IsCur2dInFaceDomain(const TopoDS_Face& face, const Handle_Geom2d_Curve& hCur2d, double first, double last, int numOfSamplePnts)
{
double tol, u, du;
gp_Pnt2d pnt;
int i;

tol = 1.0e-4; //Precision::Confusion()
BRepTopAdaptor_FClass2d CL(face,tol);

u = first;
if(numOfSamplePnts!=1)
du = (last-first)/(numOfSamplePnts-1);
for(i=0; iD0(u, pnt);
if(CL.Perform(pnt) != TopAbs_IN)
return false;
u+=du;
}
return true;
}

-Ding

tmacedo29's picture

Hi Cauchy Ding,

Thank you for your answer. I'll try it!

Regards,