MmgTools / mmg

open source software for bidimensional and tridimensional remeshing
http://www.mmgtools.org
Other
359 stars 117 forks source link

assert ( ps > 0. || ps2 > 0. && "Unexpected case") in `mmg3dBezierCP` / surface degeneracy #167

Open Algiane opened 1 year ago

Algiane commented 1 year ago

Commit f57b861966 adds an assertion on the fact that at least one of the projections of the 2 normals at a ridge point onto the normal at triangle is positive. This assertion fails on the attached mesh (where .txtextension has to be replaced by .mesh one) with commit 4883d1a0bd1d5d0bbd72a890aecd870203b9a82c and following command line :

mmg3d_debug -v 5 -noswap -nomove temp-with-ridges.mesh

temp-with-ridges.txt

Algiane commented 1 year ago

First attempt to solve this issue shows that the bug is reproductible without collapses. In this case, we see surface approximation degeneracy: triangle 12207 with vertices 15103 15104 15105 is splitted by surface patterns (anatets_iso) and point 23015 is inserted at an unexpected position.

Following picture shows initial mesh and some of inserted nodes (from left to right, nodes 23016 23015 23017). The shadows linked to the normals are disabled because smoothing hides the splitting issue (normals have probably suitable values). Capture d’écran 2022-10-17 à 11 25 49

Next picture shows a more global vue of the mesh with input ridges (mesh has been generated from structural optimization and level-set discretization with ridge detection, which has produces some artifacts). Capture d’écran 2022-10-17 à 11 26 09. The triangle that creates the issue has 1 regular point (15103) with one normal, 1 ridge point (15104) with 2 normals and one corner/required point (15105) without any normal.

Last picture shows normal at vertices (only the right mesh should be considered as input normals are erased along ridges). We can note that normals seems to have suitable values and that n1 should be used at point 15104 (it has been added by hand from gdb info inside this mesh for visualization purpose). Capture d’écran 2022-10-17 à 12 39 39

Algiane commented 1 year ago

Finally :