For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

BRepMesh_Delaun

Sushrut Pavanaskar's picture
Forums: 

I am trying to generate a surface triangulation for some solids and just cant find any documentation or example that demonstrates how to do this in the default OCCT (not paid). There is this class  BRepMesh_Delaun that I think is my best bet (short of rewriting my own Delaunay mesher or using NetGen). Can anyone please help me with a minimal working example of how to use this class to get a Delaunay surface triangulation for a bunch of 3D points? I am getting these points as vertices of a visualization mesh but created using an in-house (not OCCT) algo. I have gotten as far as:

//Create a shape, get our inhouse surface mesh, query its nodes for their UV values and use them as follows:

BRepMesh::Array1OfVertexOfDelaun vertices(1,1+(numPolygons*3));

//for each triangle in the surface mesh, query its nodes and store in the BRepMesh_Vertex to make it into a collection later

for(...)

   BRepMesh_Vertex vert(node_UV.u,node_UV.v,BRepMesh_DegreeOfFreedom::BRepMesh_OnSurface);

   verts.push_back(vert) //verts is a simple vector of BRepMesh_Vertex

//create the collection

for(int i=0; i<verts.size(); i++)

    vertices.SetValue(i+1,verts[i]);

//Initialize the Delaunay mesher using this collection

BRepMesh_Delaun b_mesh(vertices);

Handle(BRepMesh_DataStructureOfDelaun) mesh_handle = b_mesh.Result();

BRepMesh_DataStructureOfDelaun *msh = mesh_handle.get();

//query

printf("\nMeshing done, has %d elements, ",mesh->NbElements()); printf(" %d nodes",mesh->NbNodes()); printf(" %d links",mesh->NbLinks());

This produces some mesh but is not usable. I understand that I am not actually storing or passing the 3D points (positions) to the mesher but I dont know how to do that either. Can someone please help here? Thanks!