From e1b984beb4a3fa4bec659c42edbedbbf51f0850f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 1 Feb 2022 19:17:57 +0100 Subject: [PATCH 1/7] fix ununitialized variable warnings --- .../test_Collapse_edge_with_constraints.cpp | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp b/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp index 931149dbbbf..a8f84f6e654 100644 --- a/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp +++ b/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp @@ -26,9 +26,10 @@ int main() // ---------------------------------------------- // // two faces incident to the edge to be collapsed // // ---------------------------------------------- // + Point_3 p1(0,0,0), p2(1,0,0), p3(0,1,0); { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); /* ECM ecm = */m.add_property_map("ecm", false); bool res = test(h2c, m); @@ -36,7 +37,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); ECM ecm = m.add_property_map("ecm", false).first; put(ecm, edge(prev(h2c,m), m), true); @@ -46,7 +47,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); ECM ecm = m.add_property_map("ecm", false).first; put(ecm, edge(next(h2c,m), m), true); @@ -56,7 +57,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); ECM ecm = m.add_property_map("ecm", false).first; put(ecm, edge(prev(h2c,m), m), true); @@ -67,7 +68,7 @@ int main() // duplicate block + add one border (1) { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -78,7 +79,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -91,7 +92,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -104,7 +105,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -118,7 +119,7 @@ int main() // duplicate block + add one border (2) { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m); assert(is_border(hb2, m)); @@ -129,7 +130,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m); assert(is_border(hb2, m)); @@ -142,7 +143,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m); assert(is_border(hb2, m)); @@ -155,7 +156,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb2 = opposite(next(opposite(h2c,m), m), m); assert(is_border(hb2, m)); @@ -169,7 +170,7 @@ int main() // duplicate block + add one border (1) { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -183,7 +184,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -199,7 +200,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -215,7 +216,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index h2c = CGAL::Euler::add_center_vertex(h, m); Mesh::Halfedge_index hb1 = opposite(prev(h2c, m), m); assert(is_border(hb1, m)); @@ -235,7 +236,7 @@ int main() // center triangle with 2 border edges (1) { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb1=opposite(next(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m); /* ECM ecm = */m.add_property_map("ecm", false); @@ -244,7 +245,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb1=opposite(next(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m); ECM ecm = m.add_property_map("ecm", false).first; @@ -254,7 +255,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb1=opposite(next(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m); ECM ecm = m.add_property_map("ecm", false).first; @@ -265,7 +266,7 @@ int main() // center triangle with 2 border edges (2) { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb2, m), hb2, m); /* ECM ecm = */m.add_property_map("ecm", false); @@ -274,7 +275,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb2, m), hb2, m); ECM ecm = m.add_property_map("ecm", false).first; @@ -284,7 +285,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb2, m), hb2, m); ECM ecm = m.add_property_map("ecm", false).first; @@ -295,7 +296,7 @@ int main() // center triangle with 1 border edges { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb1=opposite(next(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m); Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m); @@ -306,7 +307,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb1=opposite(next(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m); Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m); @@ -318,7 +319,7 @@ int main() } { Mesh m; - Mesh::Halfedge_index h2c = CGAL::make_triangle(Point_3(),Point_3(),Point_3(),m); + Mesh::Halfedge_index h2c = CGAL::make_triangle(p1,p2,p3,m); Mesh::Halfedge_index hb1=opposite(next(h2c,m),m); CGAL::Euler::add_vertex_and_face_to_border(prev(hb1, m), hb1, m); Mesh::Halfedge_index hb2=opposite(prev(h2c,m),m); From fb4f57567c238a06d17cc17381d5cad668927a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 1 Feb 2022 19:23:54 +0100 Subject: [PATCH 2/7] avoid uninitialized variable warning --- BGL/test/BGL/test_Euler_operations.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 8d2f9df3b5c..badbb31af40 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -14,7 +14,7 @@ test_copy_face_graph_nm_umbrella() CGAL_GRAPH_TRAITS_MEMBERS(T); T g; - Kernel::Point_3 p; + Kernel::Point_3 p(0,0,0); CGAL::make_tetrahedron(p, p, p, p, g); CGAL::make_tetrahedron(p, p, p, p, g); @@ -40,7 +40,7 @@ void test_copy_face_graph_isolated_vertices() { typedef Kernel::Point_3 Point_3; - + Kernel::Point_3 p(0,0,0); { T s, t; add_vertex(s); @@ -55,7 +55,7 @@ test_copy_face_graph_isolated_vertices() { T s, t; - CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s); + CGAL::make_triangle(p, p, p, s); add_vertex(s); t=s; CGAL::copy_face_graph(s, t); @@ -63,7 +63,7 @@ test_copy_face_graph_isolated_vertices() { T s, t; - CGAL::make_triangle(Point_3(), Point_3(), Point_3(), s); + CGAL::make_triangle(p, p, p, s); add_vertex(s); add_vertex(t); CGAL::copy_face_graph(s, t); @@ -71,7 +71,7 @@ test_copy_face_graph_isolated_vertices() { T s, t; - CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s); + CGAL::make_tetrahedron(p, p, p, p, s); add_vertex(s); t=s; CGAL::copy_face_graph(s, t); @@ -79,7 +79,7 @@ test_copy_face_graph_isolated_vertices() { T s, t; - CGAL::make_tetrahedron(Point_3(), Point_3(), Point_3(), Point_3(), s); + CGAL::make_tetrahedron(p, p, p, p, s); add_vertex(s); add_vertex(t); CGAL::copy_face_graph(s, t); From 638522e7bf11031ede9b1103e992fb565f60fd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Feb 2022 08:46:46 +0100 Subject: [PATCH 3/7] remove unused typedef --- BGL/test/BGL/test_Euler_operations.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index badbb31af40..21be5413c49 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -39,7 +39,6 @@ template void test_copy_face_graph_isolated_vertices() { - typedef Kernel::Point_3 Point_3; Kernel::Point_3 p(0,0,0); { T s, t; From ba5e5e041cc8c2557e08c9e7bf0ee98ada4024d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 7 Feb 2022 09:36:26 +0100 Subject: [PATCH 4/7] avoid std::size_t to FT conversion --- .../internal/Hole_filling/Triangulate_hole_polyline.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 4f1e2b7fac8..12317131be3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -1326,7 +1326,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, } FT x = FT(0), y = FT(0), z = FT(0); - std::size_t num_normals = 0; + FT num_normals = 0; const Point_3& ref_point = P[0]; const std::size_t size = P.size() - 1; for (std::size_t i = 1; i < size - 1; ++i) { @@ -1361,9 +1361,9 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, } // Setting the final normal. - x /= static_cast(num_normals); - y /= static_cast(num_normals); - z /= static_cast(num_normals); + x /= num_normals; + y /= num_normals; + z /= num_normals; const Vector_3 avg_normal = Vector_3(x, y, z); // std::cout << "avg normal: " << avg_normal << std::endl; From 705fee5659bed36f13e9264e2e00f8221850cb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 7 Feb 2022 18:35:07 +0100 Subject: [PATCH 5/7] avoid cascading with Lazy --- .../internal/Hole_filling/Triangulate_hole_polyline.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 12317131be3..daa50a3d974 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -1326,7 +1326,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, } FT x = FT(0), y = FT(0), z = FT(0); - FT num_normals = 0; + int num_normals = 0; const Point_3& ref_point = P[0]; const std::size_t size = P.size() - 1; for (std::size_t i = 1; i < size - 1; ++i) { @@ -1361,9 +1361,10 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, } // Setting the final normal. - x /= num_normals; - y /= num_normals; - z /= num_normals; + FT ft_nn(num_normals); + x /= ft_nn; + y /= ft_nn; + z /= ft_nn; const Vector_3 avg_normal = Vector_3(x, y, z); // std::cout << "avg normal: " << avg_normal << std::endl; From 3e90db4824a96d92accec3f78bf647aefe74cf65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 8 Feb 2022 17:00:23 +0100 Subject: [PATCH 6/7] prevent another size_t to FT --- .../Hole_filling/Triangulate_hole_polyline.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index daa50a3d974..9bb40428d30 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -1243,7 +1243,7 @@ bool is_planar_2( const Squared_distance_3 squared_distance_3 = traits.compute_squared_distance_3_object(); - const std::size_t n = points.size() - 1; // the first equals to the last + const double n(points.size() - 1); // the first equals to the last if (n < 3) { return false; // cant be a plane! } @@ -1255,8 +1255,8 @@ bool is_planar_2( // Compute covariance matrix. FT xx = FT(0), yy = FT(0), zz = FT(0); FT xy = FT(0), xz = FT(0), yz = FT(0); - for (std::size_t i = 0; i < n; ++i) { - const Point_3& p = points[i]; + for (const Point_3& p : points) + { const FT dx = p.x() - centroid.x(); const FT dy = p.y() - centroid.y(); const FT dz = p.z() - centroid.z(); @@ -1280,12 +1280,12 @@ bool is_planar_2( CGAL_assertion(avg_normal != typename Traits::Vector_3()); const Plane_3 plane = Plane_3(centroid, avg_normal); FT avg_squared_distance = FT(0); - for (std::size_t i = 0; i < n; ++i) { - const Point_3& p = points[i]; + for (const Point_3& p : points) + { const Point_3 q = projection_3(plane, p); avg_squared_distance += CGAL::abs(squared_distance_3(p, q)); } - avg_squared_distance /= static_cast(n); + avg_squared_distance /= FT(n); // std::cout << "avg squared distance: " << avg_squared_distance << std::endl; CGAL_assertion(max_squared_distance >= FT(0)); From 62b54dab3fc73aded9679e6bbaa483cd57924dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 9 Feb 2022 19:04:45 +0100 Subject: [PATCH 7/7] workaround MSVC warning --- .../internal/Hole_filling/Triangulate_hole_polyline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 9bb40428d30..01bfe3912bb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -1243,7 +1243,7 @@ bool is_planar_2( const Squared_distance_3 squared_distance_3 = traits.compute_squared_distance_3_object(); - const double n(points.size() - 1); // the first equals to the last + const double n = static_cast(points.size() - 1); // the first equals to the last if (n < 3) { return false; // cant be a plane! }