Open MariusCausemann opened 1 month ago
Hi @MariusCausemann, I'm afraid I don't have any ideas, it's been a while since I've used fTetWild... Have you tried using a debugger, like gdb or lldb, to help you narrow down the problematic code?
I've tried to narrow down the problem with a debugger now. Using gdb:
Thread 1 "FloatTetwild_bi" received signal SIGSEGV, Segmentation fault.
floatTetWild::get_angle_cos (p=..., p1=..., p2=...) at /home/mariusca/emimesh/fTetWild/fTetWild-master/src/Simplification.cpp:875
875 Vector3 v1 = p1 - p;
(gdb) print p
$1 = (const floatTetWild::Vector3 &) <error reading variable: Cannot access memory at address 0x1555452abff8>
(gdb) print p1
$2 = (const floatTetWild::Vector3 &) @0x15554710b518: {<Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<Eigen::MatrixBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<Eigen::DenseBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 3>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 1>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0>> = {<Eigen::EigenBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, m_storage = {m_data = {array = {4676.6656289838811, 3589.3853991366313,
1557.1230833073887}}}}, <No data fields>}
(gdb) print p2
$3 = (const floatTetWild::Vector3 &) @0x155547131a50: {<Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<Eigen::MatrixBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<Eigen::DenseBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 3>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 1>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, 3, 1, 0, 3, 1>, 0>> = {<Eigen::EigenBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, m_storage = {m_data = {array = {4693.8347660668605, 3581.6003856561606,
1508.7043087844927}}}}, <No data fields>}
(gdb) up
#1 0x0000555555670db7 in floatTetWild::swapping (input_vertices=..., input_faces=..., tree=..., params=..., v_is_removed=..., f_is_removed=..., conn_fs=...)
at /home/mariusca/emimesh/fTetWild/fTetWild-master/src/Simplification.cpp:546
546 Scalar cos_a1 = get_angle_cos(input_vertices[n_v_ids[1]], input_vertices[v1_id], input_vertices[v2_id]);
(gdb) down
#0 floatTetWild::get_angle_cos (p=..., p1=..., p2=...) at /home/mariusca/emimesh/fTetWild/fTetWild-master/src/Simplification.cpp:875
875 Vector3 v1 = p1 - p;
(gdb) up
So it seems p
is out of memory when get_angle_cos
is being called in line 546 in Simplification.cpp. But I'm not familiar enough with the algorithm to figure out what could be going wrong...
The issue can be reproduced with:
FloatTetwild_bin --csg csgtree_roi.json --max-threads 8 --level 2 -e 0.004
The files are available here: https://drive.google.com/file/d/1cRMugFdne2H4Mi7GOxlD-sga4rv7oODW/view?usp=sharing I'd appreciate if someone could take a look! (@danielepanozzo ?)
Hi @teseoch , I've seen that you added a few fixes to the simplification process in https://github.com/wildmeshing/wildmeshing-toolkit/pull/788. Do you think those would also address this issue?
Hi, first of all, thanks for this great meshing tool! In most cases, fTetWild works very well for me, but recently, I encountered a segfault in the preprocessing stage. It is quite a complex mesh (consisting of ~200 separate surfaces) and unfortunately, I can reproduce using a simpler example. If necessary, I can provide the input files.
Here is fTetWild output:
Any idea what the problem could be? @nmnoble, I also tried your fTetWild branch, leading to the same issue. Any ideas?