From 45265a7e342955f498a062ffb9845c532efd119b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 4 Mar 2021 10:46:46 +0000 Subject: [PATCH] Replace vector with optional by two vectors. No idea what is better yet --- .../internal/Isotropic_remeshing/remesh_impl.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index d0bd9bf2a00..e2399b115e7 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -1886,7 +1886,9 @@ private: bool check_normals(const HalfedgeRange& hedges) const { std::size_t nb_patches = patch_id_to_index_map.size(); - std::vector > normal_per_patch(nb_patches,boost::none); + //std::vector > normal_per_patch(nb_patches,boost::none); + std::vector initialized(nb_patches,false); + std::vector normal_per_patch(nb_patches); for(halfedge_descriptor hd : hedges) { @@ -1900,14 +1902,17 @@ private: continue; Patch_id pid = get_patch_id(face(hd, mesh_)); std::size_t index = patch_id_to_index_map.at(pid); - if(normal_per_patch[index]){ - const Vector_3& vec = *normal_per_patch[index]; + //if(normal_per_patch[index]){ + if(initialized[index]){ + const Vector_3& vec = normal_per_patch[index]; double dot = to_double(n * vec); if (dot <= 0.){ return false; } } - normal_per_patch[index] = boost::make_optional(n); + //normal_per_patch[index] = boost::make_optional(n); + normal_per_patch[index] = n; + initialized[index] = true; } return true; }