openep / openep-core

Core OpenEP code - Matlab implementation
Apache License 2.0
8 stars 6 forks source link

geodesic_new_mesh causes segmentation fault for non-manifold meshes #55

Open p-j-smith opened 2 years ago

p-j-smith commented 2 years ago

To reproduce

load openep_dataset_2.mat
distanceBetweenPoints(userdata, 1, 2, 'method', 'geodesic')

Output Produces a segmentation fault and geodesic_library raises the error: Assertion failed: (std::find(map.begin(), map.end(), false) == map.end()), function verify, file ./geodesic_mesh.h, line 404.

Suggested fix Before calculating geodesic distances, check that both points are referenced in the triangulation (otherwise no geodesic path can be found).

p-j-smith commented 2 years ago

The problem is not that there is no path between the two points - the problem is with creating a mesh in private/geodesic_new_mesh. Line 32 is where the problem arises:

[id, tmp1, tmp2, num_edges, edges] = calllib(geodesic_library, 'new_mesh', length(p)/3, p, length(t)/3, t, 1, tmp);
p-j-smith commented 2 years ago

This issue is that the mesh in openep_dataset_2.mat is non-manifold. Perhaps meshlab could be used to re-mesh non-manifold geometries?