How to get data structure of triangulation?


First we have a TopoDS_Shape then we call "BRepMesh::Mesh(result, 0.05).
After this, we call BRepTool::Triangulation(F,L) (F = TopoDS_Face, L = TopLoc_Location) in a loop for every face in the tree (with TopExp_Explorer...). Now we can get the triangulation data for every face. Is it possible to get all triangles from a compound solid at once without iterating over all its faces. We have to get a triangle strip of a compound solid for visualization.

Andrew Hoelscher's picture

Hi all,

Was there ever a follow-up to this? I would also like to get a triangulation of a solid all at once, and then a list of triangle strips (or some other compact representation), rather than having to iterate over the faces of shape and getting individual meshes. There is a certain amount of redundancy in the later approach, and a list of individual triangles uses more memory than is necessary (as opposed to a more compact data structure).


qa qa's picture


There is no built-in way to do this. This is caused by fact that OCCT kernel tries to create a mesh for topologically invalid objects. As a result, triangle strips may not exist.

qa qa

Guido van Hilst not specified's picture

Hi Benjamin, Here is an example how to get the triangulation of a shape: 

See: MeshFromShape

​Hope it helps?