Open sloriot opened 6 years ago
In #4140, I did it a bit in lazy way by adding a new Boolean that if true
, only tries to solve self-intersections within the CC. The idea being, just lazily try to solve locally, ignoring self-intersections from other CCs, and, in a second phase, call autoref.
It works well on the dinosaur for example, which is a body with some local and artificial self-intersections, and fins that are completely disconnected CCs that strongly intersect the body (typical case of autoref being needed). Obviously a very basic example.
This naive/greedy approach is likely more expensive, but it shouldn't cause unintended damage as we can control how much change is done locally and it avoids having to devise some plan on how to distinguish.
Right now, we have two different algorithms for removing self-intersections:
These methods must be used in different situation. To make it simple, (2) is well suited to be used when the self-intersection is due to floating point rounding of coordinates and when the patch to modify is a topological disk. In cases when the mesh has real self-intersections, like a model made of two disconnected spheres intersecting for example, the autorefinement will refined both components and remove the middle part.
Beginning of a solution: Try to detect automatically which algorithm to apply is to use the incidence relationship of the faces involved in the self-intersection. To sum up, self-intersection will provides pairs of faces intersecting. Once all self-intersections are computed, we can make some patches by using incidence relationship of the _selected_faces. If within a patch, there are at least two non-incident faces intersecting then the remeshing algorithm should be used to remove it. An additional notion of size of the patch/geodesic distance between faces might also be used in order to filter out some extreme cases. If we are able to extra patches that are only intersecting each other, then the autorefinement fix might apply well.