Load grid file using TetGen in C ++

I want to load a mesh file using the TetGen library in C ++, but I don't know the correct procedure or what toggle to activate in my code to show the Delaunay Restricted mesh.

I tried something basic loading dinosaur mesh (from rocq.inria.fr) with default behavior:

tetgenio in, out;
in.firstnumber = 0;
in.load_medit("TetGen\\parasaur1_cut.mesh",0);
tetgenbehavior *b = new tetgenbehavior();
tetrahedralize(b, &in, &out);

      

The form should be like this:

enter image description here

When using TetView, it works great. But with my code, I got the following output:

dinosaur mesh result

I tried to activate the Volumetric Linear Complex (plc) property for the Delaunay constraint:

b->plc = 1;

      

and I only got a few pieces from the grid:

a few more parts from dinosaur mesh

There are probably more parts, but I don't know how to get them.

+3


source to share


1 answer


It is like you can load a square grid as a triangular grid or vice versa. One thing is clear: you are getting floats from the file, since the object boundaries look roughly correct. Make sure you load a strictly triangular or square grid. If it's a format that you can load into Blender, I would recommend loading it, triangulating it, and re-exporting it, just in case poly is laid out on it.

Another possibility is single error indexing. Are you sure you are getting each triangle / square in the correct order? That is - make sure you load triangles 123 123 123 and NOT 1 231 231 231.



Another possibility, if this format indexes all the vertices and then lists the vertex indices, you can load all the vertices correctly and then recode the triangle / quad indices as described in the previous two paragraphs. I think it is because it looks like all of your points are correct, but the lines connecting them are incorrect.

+1


source







All Articles