Is the projection of a point on a surface inside the wire?


I am an OpenCASCADE newbie, impressed by its capabilities.

I need to find if the projection of a given point on a surface (read in an IGES file) is inside this surface wire (there is no hole). This is what I have so far:

gp_Pnt p (...);
TopoDS_Face face = ... ;
Handle_Geom_Surface surface = BRep_Tool::Surface(face);
GeomAPI_ProjectPointOnSurf projection (point, surface);
double u, v;
projection.Parameters(1, u, v); // assuming there is at least one projection
TopExp_Explorer exp;
for(exp.Init(face, TopAbs_WIRE); exp.More(); exp.Next())
TopoDS_Wire wire = TopoDS::Wire(exp.Current());
// How do I check if (u,v) is inside the wire?

I tried playing with surface->Bounds(u1,u2,v1,v2) and ShapeAnalysis::GetFaceUVBounds(face,u1,u2,v1,v2) but this is not sufficient since these are BOUNDS to the parameters. I can't tell for sure with these bounds that the projection is inside the wire.

Thank you for your help,

Evgeny Lodyzhehsky's picture

Dear Marc Duflot.

To classify 2D point aP2D(u,v) you may use the class IntTools_FClass2d.

Roman Lygin's picture

Hmm, interesting.

Evgeny Nicolaich, why not BRepTopAdaptor_FClass2d? Always have used the latter until now. API's seem to be aligned. Are you aware of any advantages of IntTools_FClass2d ?


marc.duflot's picture

Thank you both for the hints.

Mehboob Bagwan's picture


anyone know how to project 3d point on wire ( containing edges of square ) ?

i tried GeomAPI_ProjectPointOnCurve api, it works only if wire containing circular edge otherwise fails.