Discern between smooth and sharp edges in triangulation


I'm looking for a way to discern between smooth and sharp edges in a triangulation.

At the moment, I take the triangulation of each face of a solid like this:

TopoDS_Face actFace = TopoDS::Face(actExp->Current());
Handle(Poly_Triangulation) facing = BRep_Tool::Triangulation(actFace, Loc);

I then use the outer wire of the face and iterate through all the edges.

TopoDS_Wire oWire = BRepTools::OuterWire(actFace);
for (BRepTools_WireExplorer actEdgeExp = BRepTools_WireExplorer(oWire); actEdgeExp.More(); actEdgeExp.Next())
TopoDS_Edge actEdge = TopoDS::Edge(actEdgeExp.Current());
if (Is_Sharp_Edge(actEdge)

In the end, I only want to have the sharp edges of each face (i.e. the edges between faces with a kink), not the ones where the two adjacent faces are (more or less) continous.

Is there an (easy) way to get this (i.e. the function Is_Sharp_Edge())?

I already found out that BRep_Tool::IsClosed() can be used to remove the seam edges, but this doesn't help for the edges in question here.

Thanks in advance,

Mikhail Sazonov's picture

Why do you consider only outer wire? I think the edges of the inner wires can also be sharp.

To know edge regularity, use the following method:

GeomAbs_Shape aRegularity = BRep_Tool::Continuity(anEdge, aFace1, aFace2);

Georg Keller's picture

Thanks for your answer. You are right, there could also be sharp edges on the inner wires.

Is there a simple way to find the faces adjacent to an edge (in order to use BRep_Tool::Continuity(anEdge, aFace1, aFace2))?

And is there a parameter to adjust the precision/tolerance for the continuity calculation?

Mikhail Sazonov's picture

See the methods TopExp::MapShapesAndAncestors, BRep_Builder::Continuity, BRepLib::EncodeRegularity.