cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Isotropic remeshing creates self intersections

Open ning-zelin opened this issue 1 year ago • 8 comments

Isotropic remeshing creates self intersections

Issue Details

My tests using the following data found that self-intersections were produced after remesh, even if I set do_collapse(false).

Source Code

if(PMP::does_self_intersect(mesh)){
  std::cout<<"input mesh self-intersect"<<std::endl;
}
PMP::isotropic_remeshing(faces(mesh), 0.3, mesh,
                         CGAL::parameters::number_of_iterations(10)
                                          .protect_constraints(true).do_collapse(false)); //i.e. protect border, here
if(PMP::does_self_intersect(mesh)){
  std::cout<<"out-put mesh self-intersect"<<std::endl;
}
  • Operating system: Ubuntu20.04
  • Input mesh: merged_3.zip
  • CGAL 5.6.1

ning-zelin avatar Apr 10 '24 14:04 ning-zelin

@janetournois It seems to come from the projection step. The vertex 2459 is very close to a face in the input: image In the output, I guess it gets projected onto the face rather that the original vertex (probably because of the smoothing that moves it). I'm not sure we can do much in such a case. For sure adding that vertex as constrained vertex would fix the issue, but it's a "manual" fix.

As it seems the mesh was not combinatorially modified near that vertex, maybe the smoothing should only apply to modified regions?

sloriot avatar Apr 10 '24 15:04 sloriot

But it still has self-intersections after setting do_projection to false.

  PMP::isotropic_remeshing(faces(mesh), 0.3, mesh,
                           CGAL::parameters::number_of_iterations(10)
                                            .protect_constraints(true).do_project(false)); 

ning-zelin avatar Apr 10 '24 15:04 ning-zelin

As I tried to say, I guess that the smoothing moves the vertex across the face and the projection put it on the face.

sloriot avatar Apr 10 '24 15:04 sloriot

You can try disabling the smoothing

sloriot avatar Apr 10 '24 15:04 sloriot

As I tried to say, I guess that the smoothing moves the vertex across the face and the projection put it on the face.

Thanks. I set number_of_relaxation_steps(0), and the problem was solved.

ning-zelin avatar Apr 10 '24 16:04 ning-zelin

As I tried to say, I guess that the smoothing moves the vertex across the face and the projection put it on the face.

Thanks. I set number_of_relaxation_steps(0), and the problem was solved.

Thank you very much for your assistance. I conducted further tests, and although probability of occurrence is less, it still doesn't resolve all cases.

  PMP::isotropic_remeshing(faces(merge_mesh), 0.3, merge_mesh,
                           CGAL::parameters::number_of_iterations(3).number_of_relaxation_steps(0).do_project(false) 

merged_43.zip

ning-zelin avatar Apr 11 '24 02:04 ning-zelin

Hello @ning-zelin The example functor I proposed in PR #8210 above is not 100% reliable for your problem, but it works and avoids creation of self-intersections on your data

janetournois avatar May 17 '24 08:05 janetournois

Hello @janetournois Thank you for your response. Could you please advise if there is any method or engineering trick that could fully resolve this issue? Thank you again for your assistance!

ning-zelin avatar May 20 '24 14:05 ning-zelin

THe pull-request https://github.com/CGAL/cgal/pull/8210 has been merged.

lrineau avatar Sep 27 '24 14:09 lrineau