From 1f91e3df40327cac6cdf3cbe12790a4b6ff9719f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 20 Mar 2025 16:28:42 +0100 Subject: [PATCH] Misc minor changes --- .../examples/Isosurfacing_3/dual_contouring_octree.cpp | 6 +++++- Isosurfacing_3/include/CGAL/Isosurfacing_3/IO/Image_3.h | 2 +- .../CGAL/Isosurfacing_3/internal/dual_contouring_functors.h | 1 - .../CGAL/Isosurfacing_3/internal/marching_cubes_functors.h | 5 +++-- .../CGAL/Isosurfacing_3/internal/partition_traits_Octree.h | 2 +- .../topologically_correct_marching_cubes_functors.h | 1 - Isosurfacing_3/package_info/Isosurfacing_3/dependencies | 2 +- Orthtree/include/CGAL/Orthtree.h | 4 ++-- 8 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp index b705b8e1b99..e537efe1c53 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp @@ -29,6 +29,8 @@ using Gradients = CGAL::Isosurfacing::Gradient_function_3; using MC_Domain = CGAL::Isosurfacing::Marching_cubes_domain_3; using Domain = CGAL::Isosurfacing::Dual_contouring_domain_3; +namespace IS = CGAL::Isosurfacing; + // Refine one of the octant struct Refine_one_eighth { @@ -114,7 +116,9 @@ int main(int argc, char** argv) Polygon_range triangles; // run Dual Contouring - CGAL::Isosurfacing::dual_contouring(domain, isovalue, points, triangles, CGAL::parameters::do_not_triangulate_faces(true)); + IS::dual_contouring(domain, isovalue, points, triangles, + CGAL::parameters::do_not_triangulate_faces(true) + .constrain_to_cell(false)); // run Marching Cubes // ToDo: Does not yet work with topologically correct marching cubes diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/IO/Image_3.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/IO/Image_3.h index c41274fdf8b..a8d1a033a27 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/IO/Image_3.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/IO/Image_3.h @@ -130,7 +130,7 @@ CGAL::Image_3 convert_grid_to_image(const Grid& grid, // error handling if(im == nullptr || im->data == nullptr) - throw std::bad_alloc(); // @todo idk? + throw std::bad_alloc(); // set min coordinates const Point_3& min_p = vertex(grid.span(), 0); diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/dual_contouring_functors.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/dual_contouring_functors.h index 0883bcc02a9..a15703e75a5 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/dual_contouring_functors.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/dual_contouring_functors.h @@ -180,7 +180,6 @@ bool cell_position_QEM(const typename Domain::cell_descriptor& c, Eigen_vector_x v_svd; v_svd = x_hat + svd.solve(rhs - A * x_hat); - if(constrain_to_cell) { // @todo clamping back doesn't necessarily yield the optimal position within the cell diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/marching_cubes_functors.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/marching_cubes_functors.h index c97392b3961..cabd33db179 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/marching_cubes_functors.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/marching_cubes_functors.h @@ -116,6 +116,8 @@ std::size_t get_cell_corners(const Domain& domain, // collect function values and build index std::size_t v_id = 0; std::bitset index = 0; + static_assert(Domain::VERTICES_PER_CELL == 8); + for(const vertex_descriptor& v : vertices) { auto val = domain.value(v); @@ -199,7 +201,6 @@ void MC_construct_triangles(const std::size_t i_case, if(Cube_table::triangle_cases[t_index] == -1) break; - // @todo move more of this stuff into the table const int eg0 = Cube_table::triangle_cases[t_index + 0]; const int eg1 = Cube_table::triangle_cases[t_index + 1]; const int eg2 = Cube_table::triangle_cases[t_index + 2]; @@ -298,7 +299,7 @@ public: CGAL_precondition(m_domain.cell_vertices(cell).size() == 8); CGAL_precondition(m_domain.cell_edges(cell).size() == 12); - // @todo for SDFs, we could query at the center of the voxel an early exit + // @speed for SDFs, we could query at the center of the voxel an early exit constexpr std::size_t vpc = Domain::VERTICES_PER_CELL; diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/partition_traits_Octree.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/partition_traits_Octree.h index fa7785c2bcb..eccd3a247dd 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/partition_traits_Octree.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/partition_traits_Octree.h @@ -394,7 +394,7 @@ public: Sequential_tag) { for(const edge_descriptor& e : get_leaf_edges(o)) - f(e); + f(e); } template diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h index f70b585e996..bf266275f5e 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h @@ -184,7 +184,6 @@ public: if(Cube_table::triangle_cases[t_index] == -1) break; - // @todo move more of this stuff into the table const int eg0 = Cube_table::triangle_cases[t_index + 0]; const int eg1 = Cube_table::triangle_cases[t_index + 1]; const int eg2 = Cube_table::triangle_cases[t_index + 2]; diff --git a/Isosurfacing_3/package_info/Isosurfacing_3/dependencies b/Isosurfacing_3/package_info/Isosurfacing_3/dependencies index 7e5ebeb9306..64e88168233 100644 --- a/Isosurfacing_3/package_info/Isosurfacing_3/dependencies +++ b/Isosurfacing_3/package_info/Isosurfacing_3/dependencies @@ -1,7 +1,7 @@ Algebraic_foundations BGL -Cartesian_kernel CGAL_ImageIO +Cartesian_kernel Circulator Distance_2 Distance_3 diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index 6159c881c5a..aad8f8868ea 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -522,11 +522,11 @@ public: compute_cartesian_coordinate(std::uint32_t gc, std::size_t depth, int ci) const { CGAL_assertion(depth <= m_side_per_depth.size()); - // an odd coordinate will be first compute at the current depth, + // an odd coordinate will be first computed at the current depth, // while an even coordinate has already been computed at a previous depth. // So while the coordinate is even, we decrease the depth to end up of the first // non-even coordinate to compute it (with particular case for bbox limits). - // Note that is depth becomes too large, we might end up with incorrect coordinates + // Note that if the depth becomes too large, we might end up with incorrect coordinates // due to rounding errors. if (gc == (1u << depth)) return (m_bbox.max)()[ci]; // gc == 2^node_depth if (gc == 0) return (m_bbox.min)()[ci];