nzfeng / signed-heat-3d

MIT License
72 stars 8 forks source link

Using tetmesh results in core dumped #4

Open BartBruininks opened 2 months ago

BartBruininks commented 2 months ago

Using a broken bilayer mesh with the tetmesh and default options causes the following error:

[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 4.6 (Core Profile) Mesa 21.2.6
Delaunizing vertices...
Delaunay seconds:  0.000242
Creating surface mesh ...
Surface mesh seconds:  0.000137
Recovering boundaries...
terminate called after throwing an instance of 'int'
Aborted (core dumped) 

The mesh was generated using blender voxel remesh and is well oriented. Using the grid based approach does work.

broken_bilayer broken-bilayer_low-poly.ply.gz

nzfeng commented 2 months ago

Sometimes TetGen (the library responsible for tetmeshing) throws errors and fails to mesh, so I wrapped its tetrahedralize function in try-catch blocks in lines 967 and 1078. Since you aren't getting error code output, and your program is failing on the first instance of tetrahedralize, it must be line 1213 that's giving an error, though I can't imagine how since it's just meshing a simple cube with no constraints.

I don't get any errors on my machine when I run the program on your model:

image

This is a total shot in the dark, but does increasing the value of the scale parameter in triangulateCube() help? Or perhaps scaling your mesh up? If I had to guess, maybe TetGen is having numerical difficulty (though I can't imagine why since your model is a "normal" size.)

Other than that I have little clue. Let me know how it goes, and if you observe any other weird behavior!

BartBruininks commented 2 months ago

I tried both your suggestions of scaling the input mesh and/or scaling the factor (and recompile). None of these changes fixed the crash. I will try to run this on a different machine to see if that makes the difference for me as well.

For completeness this is the error after changing the scale factor to 3. (from 2.) at triangulateCube().

[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 4.6 (Core Profile) Mesa 21.2.6
Delaunizing vertices...
Delaunay seconds:  0.00023
Creating surface mesh ...
Surface mesh seconds:  0.000114
Recovering boundaries...
terminate called after throwing an instance of 'int'
Aborted (core dumped)