BRepAlgo_Section correct orientation problem

Hello I´m using BRepAlgo_Section to calculate the intersection between two faces.The result is in my case always an wire. Depending on how I position the faces the resulting wire differ in there orientation (altrough the value myWire.Orientation() is in both cases the same). I tested it by using the wires (of my example) to create face - which is drilled.

Example: http://rapidshare.com/files/253413298/SampleSection.jpg.html
The outer wires of the red faces are used!!!

As far as I understand the problem occurs because I sometimes calculate the sections of the faces where the share the same edge. Has someone an idea to find out if the wire has to be reoriented????

Thanks in advance - Stefan
(If someone needs more informations, images... just ask.)

Bearloga's picture

Hi Stefan,
Y may check the faces normals. At any point on the section wire, retrieve the normals to the result (red) face and to one of input faces. Then check the sign of the scalar product of these normals. The negative sign means the wire (or the face built on it) needs to be reversed.