Tetgen's input and output are text files. I'll be using the following file formats proposed by tetgen:
.node-file: The node files is just a text file with a few points in it. My program currently constructs a node file containing all the points of the armature and the vertices of a given object. Take note though, that in Unity, most vertices are duplicated because Unity requires the same amount of vertices as the object has faces. So my program first removes all the duplicate vertices before adding them to the .node file. The node file is then used as input for tetgen. The output produces three files, one of them is another node containing all the vertices of the tetrahedralization.
.poly-file: I'm currently not using this file format anymore. It is used to describe a PLC (piecewise linear complex). It's basically a concatenation of a node file and a face file. I tried to get some tetrahedralizations using this file format but that lead to several problems. The mayor issue was that a PLC always needs to be "waterproof". Considering the fact that the armature and the object are two different entities, trying to pool them together as one PLC doesn't work.
.ele-file: This is one of the output files produced by tetgen. It contains al the actual tetrahedra. A tetrahedron is descibed by four corners, which in this case are just indices to the vertices descrbied in the output .node-file.
Remaining problems:
- Currently I'm still calling tetgen as a command line program. This slows down my program considerably. I should try and integrate Tetgen into the unity scripts but this could prove problematic because tetgen is written in C++ and Unity uses C#. As a result, the interaction mesh isn't updated every frame, but rather on command when the user presses the 'i'-button.
- There is a bug in the program that makes a vertex dissapear out of the node file. This causes array index out of bound exceptions and prohibits the interaction mesh from being drawn. I'm still looking for the cause (could be the parser, could be the part that constructs the input node file, etc.).
- Another bug ensures the interaction mesh isn't always drawn immediately on startup. I'm also still looking into this. This problem could be related to the previous problem.
did you integrated successfully tetgen into unity? i need some help on that.
BeantwoordenVerwijderen