isotropic remeshing

This commit is contained in:
Andreas Fabri 2022-10-12 09:59:35 +01:00
parent 3e90f9ccf7
commit 341e1167a8
1 changed files with 19 additions and 6 deletions

View File

@ -405,7 +405,9 @@ namespace internal {
} }
//split long edges //split long edges
#ifdef CGAL_PMP_REMESHING_VERBOSE
unsigned int nb_splits = 0; unsigned int nb_splits = 0;
#endif
while (!long_edges.empty()) while (!long_edges.empty())
{ {
//the edge with longest length //the edge with longest length
@ -420,7 +422,9 @@ namespace internal {
// propagate the constrained status // propagate the constrained status
put(ecmap_, edge(hnew, mesh_), get(ecmap_, edge(he, mesh_))); put(ecmap_, edge(hnew, mesh_), get(ecmap_, edge(he, mesh_)));
CGAL_assertion(he == next(hnew, mesh_)); CGAL_assertion(he == next(hnew, mesh_));
#ifdef CGAL_PMP_REMESHING_VERBOSE
++nb_splits; ++nb_splits;
#endif
//move refinement point //move refinement point
vertex_descriptor vnew = target(hnew, mesh_); vertex_descriptor vnew = target(hnew, mesh_);
@ -642,7 +646,9 @@ namespace internal {
std::cout << "done." << std::endl; std::cout << "done." << std::endl;
#endif #endif
#ifdef CGAL_PMP_REMESHING_VERBOSE
unsigned int nb_collapses = 0; unsigned int nb_collapses = 0;
#endif
while (!short_edges.empty()) while (!short_edges.empty())
{ {
//the edge with shortest length //the edge with shortest length
@ -779,8 +785,9 @@ namespace internal {
vertex_descriptor vkept = CGAL::Euler::collapse_edge(e, mesh_, ecmap_); vertex_descriptor vkept = CGAL::Euler::collapse_edge(e, mesh_, ecmap_);
CGAL_assertion(is_valid(mesh_)); CGAL_assertion(is_valid(mesh_));
CGAL_assertion(vkept == vb);//is the constrained point still here CGAL_assertion(vkept == vb);//is the constrained point still here
#ifdef CGAL_PMP_REMESHING_VERBOSE
++nb_collapses; ++nb_collapses;
#endif
//fix constrained case //fix constrained case
CGAL_assertion((is_constrained(vkept) || is_corner(vkept) || is_on_patch_border(vkept)) == CGAL_assertion((is_constrained(vkept) || is_corner(vkept) || is_on_patch_border(vkept)) ==
(is_va_constrained || is_vb_constrained || is_va_on_constrained_polyline || is_vb_on_constrained_polyline)); (is_va_constrained || is_vb_constrained || is_va_on_constrained_polyline || is_vb_on_constrained_polyline));
@ -842,7 +849,9 @@ namespace internal {
const double cap_threshold = std::cos(160. / 180 * CGAL_PI); const double cap_threshold = std::cos(160. / 180 * CGAL_PI);
#ifdef CGAL_PMP_REMESHING_VERBOSE
unsigned int nb_flips = 0; unsigned int nb_flips = 0;
#endif
for(edge_descriptor e : edges(mesh_)) for(edge_descriptor e : edges(mesh_))
{ {
//only the patch edges are allowed to be flipped //only the patch edges are allowed to be flipped
@ -906,8 +915,9 @@ namespace internal {
put(degree, vc, vvc); put(degree, vc, vvc);
put(degree, vd, vvd); put(degree, vd, vvd);
#ifdef CGAL_PMP_REMESHING_VERBOSE
++nb_flips; ++nb_flips;
#endif
#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS #ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS
std::cout << "\r\t(" << nb_flips << " flips)"; std::cout << "\r\t(" << nb_flips << " flips)";
std::cout.flush(); std::cout.flush();
@ -956,8 +966,9 @@ namespace internal {
put(degree, vc, vvc); put(degree, vc, vvc);
put(degree, vd, vvd); put(degree, vd, vvd);
#ifdef CGAL_PMP_REMESHING_VERBOSE
--nb_flips; --nb_flips;
#endif
CGAL_assertion_code(Halfedge_status s3 = status(he)); CGAL_assertion_code(Halfedge_status s3 = status(he));
CGAL_assertion(s1 == s3); CGAL_assertion(s1 == s3);
CGAL_assertion(!is_border(he, mesh_)); CGAL_assertion(!is_border(he, mesh_));
@ -1635,8 +1646,6 @@ private:
const double& sq_low, const double& sq_low,
const bool collapse_constraints) const bool collapse_constraints)
{ {
CGAL_assertion_code(std::size_t nb_done = 0);
std::unordered_set<halfedge_descriptor> degenerate_faces; std::unordered_set<halfedge_descriptor> degenerate_faces;
for(halfedge_descriptor h : for(halfedge_descriptor h :
halfedges_around_target(halfedge(v, mesh_), mesh_)) halfedges_around_target(halfedge(v, mesh_), mesh_))
@ -1695,7 +1704,6 @@ private:
continue; continue;
CGAL::Euler::flip_edge(hf, mesh_); CGAL::Euler::flip_edge(hf, mesh_);
CGAL_assertion_code(++nb_done);
done = true; done = true;
//update status //update status
@ -1891,6 +1899,11 @@ private:
else if(is_an_isolated_constraint(h)) nb_isolated++; else if(is_an_isolated_constraint(h)) nb_isolated++;
else CGAL_assertion(false); else CGAL_assertion(false);
} }
CGAL_USE(nb_border);
CGAL_USE(nb_mesh);
CGAL_USE(nb_patch);
CGAL_USE(nb_patch_border);
CGAL_USE(nb_isolated);
} }
#ifdef CGAL_PMP_REMESHING_DEBUG #ifdef CGAL_PMP_REMESHING_DEBUG