From 81d7fce5bc18b46604a960ca21d10a359ea7069e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 13 Feb 2024 14:06:10 +0100 Subject: [PATCH] new markers for vertices --- .../Conforming_Delaunay_triangulation_3.h | 2 + .../Constrained_Delaunay_triangulation_3.h | 45 +++++++++++-------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Triangulation_3/include/CGAL/Conforming_Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Conforming_Delaunay_triangulation_3.h index 4ff0b7e7c7d..4e085063950 100644 --- a/Triangulation_3/include/CGAL/Conforming_Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Conforming_Delaunay_triangulation_3.h @@ -47,6 +47,8 @@ enum class CDT_3_vertex_marker { REGION_BORDER, REGION_INSIDE, CAVITY, + CAVITY_ABOVE, + CAVITY_BELOW, nb_of_markers }; diff --git a/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h index 7eb7e14a898..3a3e95ab3f2 100644 --- a/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h @@ -281,10 +281,17 @@ struct Output_rep, With_point_and_info_t std::ostream& operator()(std::ostream& out) const { out << Time_stamper::display_id(this->it.operator->(), offset); - if(this->it.operator->() != nullptr) - return out << (this->it->is_Steiner_vertex_on_edge() ? "(Steiner)" : "") - << (this->it->is_Steiner_vertex_in_face() ? "(Steiner in face)" : "") - << "= " << this->it->point(); + if(this->it.operator->() != nullptr) { + out << (this->it->is_Steiner_vertex_on_edge() ? "(Steiner)" : "") + << (this->it->is_Steiner_vertex_in_face() ? "(Steiner in face)" : "") + << "= " << this->it->point(); + if(this->it->is_marked(CDT_3_vertex_marker::REGION_BORDER)) out << " (region border)"; + if(this->it->is_marked(CDT_3_vertex_marker::REGION_INSIDE)) out << " (inside region)"; + if(this->it->is_marked(CDT_3_vertex_marker::CAVITY)) out << " (cavity vertex)"; + if(this->it->is_marked(CDT_3_vertex_marker::CAVITY_ABOVE)) out << " (vertex above)"; + if(this->it->is_marked(CDT_3_vertex_marker::CAVITY_BELOW)) out << " (vertex below)"; + return out; + } else return out; } @@ -1575,28 +1582,32 @@ private: v->clear_mark(Vertex_marker::CAVITY); if(vertices_of_border_union_find.same_set(handle, vertex_above_handle)) { vertices_of_upper_cavity.push_back(v); + v->set_mark(Vertex_marker::CAVITY_ABOVE); } else if(vertices_of_border_union_find.same_set(handle, vertex_below_handle)) { vertices_of_lower_cavity.push_back(v); + v->set_mark(Vertex_marker::CAVITY_BELOW); } else { CGAL_error(); } } for(auto facet: facets_of_border) { for(auto v: tr.vertices(facet)) { - if(v->is_marked()) { - continue; - } - auto handle = vertices_of_border_handles[v]; - if(vertices_of_border_union_find.same_set(handle, vertex_above_handle)) { + if(v->is_marked(Vertex_marker::CAVITY_ABOVE)) { facets_of_upper_cavity.push_back(facet); - } else if(vertices_of_border_union_find.same_set(handle, vertex_below_handle)) { - facets_of_lower_cavity.push_back(facet); - } else { - CGAL_error(); + break; + } + if(v->is_marked(Vertex_marker::CAVITY_BELOW)) { + facets_of_lower_cavity.push_back(facet); + break; } - break; } } + for(auto v: vertices_of_border_union_find) + { + v->clear_mark(Vertex_marker::CAVITY_ABOVE); + v->clear_mark(Vertex_marker::CAVITY_BELOW); + } + return outputs; } @@ -1824,10 +1835,8 @@ private: }); auto is_facet_of_polygon = [&](const auto& tr, Facet f) { - const auto [c, facet_index] = f; - for(int i = 0; i < 3; ++i) { - const auto vh = c->vertex(T_3::vertex_triple_index(facet_index, i)); - if(0 == polygon_points.count(tr.point(vh))) { + for(const auto vh: tr.vertices(f)) { + if(!vh->is_marked()) { return false; } }