Dear developers and users,
I have a program that creates faces (lying in the same z-plane). The faces are built from closed wires with BRepBuilderAPI_MakeFace. A wire can be an outer wire (CCW direction) or an inner wire (CW direction). The program itself can group the wires into groups of wires that lie inside each other, however there is one problem:
In some occasions there can be redundant information. An outer wire can lie inside an outer wire (so both the same directions). In the pictures I provided you can see what happens. All 3 cases are built with one instance of BRepBuilderAPI_MakeFace. Case 1 and 3 are perfectly fine, in case 2 there is redundant info (wires with the same direction). You get an invisible outer wire, which is not the desired result.
After trying several options and building an algorithm that can detect if a wire should be added or not, there only lacks one thing, resulting in my question:
Does there exists a way to check the clockwise/counter-clockwise direction of a wire before adding the wire?
I'm assuming there should exist some way to check this, as the BRepBuilderAPI_MakeFace knows it (I'm assuming). TopoDS_Shape::Orientation() always gives forward direction, but I guess this is normal because the wire's orientation is not relative to anything (although creating a face with an inner wire gives the same orientation). My own algorithms for detecting wire direction work 90% of the time, but fail at shapes like arcs.
If this is not possible, does there exist a way to fix the face you become. I know about the ShapeFix_Face library, but this seems to invert the direction instead of leaving the redunant wire out of the face.
A lot of thanks in advance,