zishun / geodesic_matlab

Exact geodesic for triangular meshes implemented by Danil Kirsanov
https://mathworks.com/matlabcentral/fileexchange/18168-exact-geodesic-for-triangular-meshes
BSD 2-Clause "Simplified" License
22 stars 8 forks source link

geodesic_new_mesh causes segmentation fault for some meshes #6

Closed p-j-smith closed 2 years ago

p-j-smith commented 2 years ago

Hi, thank you for creating geodesic_matlab!

For some inputs, geodesic_new_mesh causes a segmentation fault. This issue occurs on line 32, where the library is called:

[id, tmp1, tmp2, num_edges, edges] = calllib(geodesic_library, 'new_mesh', length(p)/3, p, length(t)/3, t, 1, tmp);

To reproduce:

load points.mat
load tri.mat
geodesic_new_mesh(points, tri)

I've included points.mat, tri.mat, and the crash report in new_mesh_crashes.zip

Any suggestions would be much appreciated!

zishun commented 2 years ago

Hi! I think the problem is the mesh is not manifold, as shown in the red circle. Screenshot from 2022-01-19 20-18-20

p-j-smith commented 2 years ago

Ah, that makes sense, thank you so much for your fast response :)