In computer graphics, it's common to use *.node
and *.ele
files to store tetrahedral mesh, where the former one stores 3D coordinates (x,y,z)
of all the vertices and the latter one stores the indices of every tetrahedron, such as
#<tetrahedron index> <vertex 1> <vertex 2> <vertex 3> <vertex 4> <attribute>
1 1 2 3 4 1
... ... ... ... ... ...
which means a tetrahedron with index 1 consists of vertices with indices 1, 2, 3, 4 and has attribute 1.
However, it is difficult to visualize such kinds of files. So are there any libraries which can convert such kinds of *.node
and *.ele
files into *.obj
or *.ply
files for visualization in MeshLab?
Many thanks!
Use TetGen:
tetgen -r my_node_file -O
. This should output amy_node_file.off
file with a format similar to PLY or OBJ files (the file can either be patched in a text editor to PLY or MeshLab can do the conversion). However I believe this works only with TetGen version <= 1.4 (in 1.5, the-O
option has a different meaning).That being said, it should also be trivial to write a custom parser that will generate a PLY or OBJ file (and you gain the flexibility of filtering by attributes or do some other processing on the faces of the tetrahedral mesh).