Inner and Outer Wire

A face (TopoDS_Face) is composed from wire (topoDS_Wire). How to distinguish inner wire (hole) from the outer wire ?

Igor Feoktistov's picture

Hello, Xavier

you can use method BRepTools::OuterWire(face) to get outer wire of face, then select wires which are not equal outer wire.

Second way is to use 2d classifier:

TopoDS_Wire anInnerWire;

TopExp_Explorer expw (aFace, TopAbs_WIRE);

Standard_Real aFaceTolerance=BRep_Tool::Tolerance(aFace); TopLoc_Location Loc; Handle(Geom_Surface) Surf = BRep_Tool::Surface(TopoDS::Face(aFace), Loc); for ( ;expw.More();expw.Next()) { const TopoDS_Wire& aWire=TopoDS::Wire(expw.Current()); TopoDS_Face newFace; BRep_Builder BB; BB.MakeFace(newFace, Surf, Loc, aFaceTolerance); BB.Add(newFace, aWire); BRepTopAdaptor_FClass2d aClass2d(newFace, aFaceTolerance); TopAbs_State aState=aClass2d.PerformInfinitePoint(); if (aState==TopAbs_IN) {


.... } .....

For inner wire infinite point is inside wire.

Best regards, Igor