Howto create ON_Mesh from triangles

Hi,

i’m sure it’s a dumb question but I could not find a better solution.
What i have is an already triangulated mesh from a point cloud. Now i want to visualize it in Rhino by creating an ON_Mesh. For this i create a lot of ON_Mesh instances with RhinoMeshFace for each triangle and put it all together with ON_Mesh::Append. But for large meshes it’s pretty slow.

So what i’m looking for is a faster way to create an ON_Mesh directly from the list of triangles?

BTW: i’m working in c++

Thanks

Hi @dsw,

I don’t believe there is anything on openNURBS that will build a mesh from a list of triangles. You’ll need to just write one yourself.

– Dale

Hi @dale,

yes i already tried it by adding the data to the list of vertices and the list of faces, but the mesh does not recognize this data when i add it to the document.
So can you give me a rough idea howto fill the data in an ON_Mesh?

Hi @dsw,

I’ve attached a simple example.

cmdTestTriangleMesh.cpp (3.7 KB)

I’m sure there are other ways of doing this.

– Dale

Thank you @dale, works perfectly.