Determine which BrepFace is on the left side of the BrepEdge

Hi all

I have one issue. I have ON_Brep object and I need to determine which face is on left side and which face is on right side of each BrepEdge (exept boundary edges) according to edge direction.

I tried in this way:
int loopIndex1 = Brep->m_T[Brep->m_E[edgeIndex].m_ti[0]].m_li;
int loopIndex2 = Brep->m_T[Brep->m_E[edgeIndex].m_ti[1]].m_li;
int rightFaceIndex = Brep->m_L[loopIndex1].m_fi;
int leftFaceIndex = Brep->m_L[loopIndex2].m_fi;

But it gives me bad results.

Hi Biljana,

The left side will have Trim.m_bRev == Face.m_bFlip. The right side has them not equal.

This is assuming that the face normals are consistent across the edge when taking m_bFlip into consideration.

Does this help?

– Dale

Yes. It helps.
Thank you very mach Dale

Hi Dale, I can’t find those flags in C#. How do I check if the edge taking from Brep.Edges array has the same direction inside the face or it is reversed?

Hi @Ali5,

Try using BrepTrim.IsReversed and BrepFace.OrientationIsReversed.

– Dale

Hi @dale thanks, that was the flag I was looking for