From 67bf9af86a0ebcc7e06e11b352f182b8868fff82 Mon Sep 17 00:00:00 2001 From: Julian Stahl Date: Thu, 8 Dec 2022 21:06:06 +0100 Subject: [PATCH] Replace iso(-|_)value with isovalue --- .../benchmark/Isosurfacing_3/benchmark.cpp | 2 +- .../doc/Isosurfacing_3/Isosurfacing_3.txt | 4 +- .../dual_contouring_implicit_iwp.cpp | 2 +- .../include/CGAL/Dual_contouring_3.h | 10 ++--- .../internal/Dual_contouring_internal.h | 38 +++++++++---------- .../internal/Marching_cubes_3_internal.h | 22 +++++------ .../Isosurfacing_3/internal/Tmc_internal.h | 14 +++---- .../include/CGAL/Marching_cubes_3.h | 8 ++-- .../Isosurfacing_3/test_marching_cubes.cpp | 4 +- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Isosurfacing_3/benchmark/Isosurfacing_3/benchmark.cpp b/Isosurfacing_3/benchmark/Isosurfacing_3/benchmark.cpp index ca361669170..d71fb425fe2 100644 --- a/Isosurfacing_3/benchmark/Isosurfacing_3/benchmark.cpp +++ b/Isosurfacing_3/benchmark/Isosurfacing_3/benchmark.cpp @@ -72,7 +72,7 @@ struct IWPValue { const FT x = alpha * (point.x() + 1) * M_PI; const FT y = alpha * (point.y() + 1) * M_PI; const FT z = alpha * (point.z() + 1) * M_PI; - return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // iso-value = 0 + return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // isovalue = 0 } }; diff --git a/Isosurfacing_3/doc/Isosurfacing_3/Isosurfacing_3.txt b/Isosurfacing_3/doc/Isosurfacing_3/Isosurfacing_3.txt index fc8f5621570..acc27553ad9 100644 --- a/Isosurfacing_3/doc/Isosurfacing_3/Isosurfacing_3.txt +++ b/Isosurfacing_3/doc/Isosurfacing_3/Isosurfacing_3.txt @@ -120,12 +120,12 @@ Each algorithm can be called by a single templated function, and the function si \code{.cpp} template -void marching_cubes(const Domain_& domain, const typename Domain_::FT iso_value, PointRange& points, PolygonRange& polygons); +void marching_cubes(const Domain_& domain, const typename Domain_::FT isovalue, PointRange& points, PolygonRange& polygons); \endcode The input is provided in the form of a `domain` (see \ref secmydomains). -The `iso_value` scalar parameter denotes the value used for sampling the input scalar field for generating the isosurface. +The `isovalue` scalar parameter denotes the value used for sampling the input scalar field for generating the isosurface. [why using the term collection below ? how about containers? ] diff --git a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp index 648c6254732..1cb31a3937f 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp @@ -20,7 +20,7 @@ int main() { const FT x = alpha * (point.x() + 1) * CGAL_PI; const FT y = alpha * (point.y() + 1) * CGAL_PI; const FT z = alpha * (point.z() + 1) * CGAL_PI; - return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // iso-value = 0 + return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // isovalue = 0 }; auto iwp_gradient = [alpha](const Point& point) { diff --git a/Isosurfacing_3/include/CGAL/Dual_contouring_3.h b/Isosurfacing_3/include/CGAL/Dual_contouring_3.h index 067697d2c12..4cd3398c2e9 100644 --- a/Isosurfacing_3/include/CGAL/Dual_contouring_3.h +++ b/Isosurfacing_3/include/CGAL/Dual_contouring_3.h @@ -39,26 +39,26 @@ namespace Isosurfacing { * `RandomAccessContainer` and `BackInsertionSequence` whose value type is itself a model of the concepts * `RandomAccessContainer` and `BackInsertionSequence` whose value type is `std::size_t`. * - * \tparam Positioning is a functor containing the function `position` that takes `domain`, `iso_value`, `cell`, and `position` + * \tparam Positioning is a functor containing the function `position` that takes `domain`, `isovalue`, `cell`, and `position` * as input and returns a boolean that is `true` if the isosurface intersects the cell. * * \param domain the domain providing input data and its topology - * \param iso_value value of the isosurface + * \param isovalue value of the isosurface * \param points points of the polzgons in the created indexed face set * \param polygons each element in the vector describes a polygon using the indices of the points in `points` * \param positioning the functor dealing with vertex positioning inside a cell */ template > -void dual_contouring(const Domain_& domain, const typename Domain_::FT iso_value, PointRange& points, +void dual_contouring(const Domain_& domain, const typename Domain_::FT isovalue, PointRange& points, PolygonRange& polygons, const Positioning& positioning = Positioning()) { // create vertices in each relevant cell - internal::Dual_contouring_vertex_positioning pos_func(domain, iso_value, positioning); + internal::Dual_contouring_vertex_positioning pos_func(domain, isovalue, positioning); domain.template iterate_cells(pos_func); // connect vertices around an edge to form a face - internal::Dual_contouring_face_generation face_generation(domain, iso_value); + internal::Dual_contouring_face_generation face_generation(domain, isovalue); domain.template iterate_edges(face_generation); // copy vertices to point range diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h index 018ee139c89..5630ed6eb7c 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Dual_contouring_internal.h @@ -54,14 +54,14 @@ public: * \tparam Domain_ must be a model of `IsosurfacingDomainWithGradient`. * * \param domain the domain providing input data and its topology - * \param iso_value value of the isosurface + * \param isovalue value of the isosurface * \param cell the cell within the domain for which the vertex position ins computed * \param point the point position of the vertex that belongs to that cell * * \return true, if the voxel intersects the isosurface */ template - bool position(const Domain_& domain, const typename Domain_::FT iso_value, + bool position(const Domain_& domain, const typename Domain_::FT isovalue, const typename Domain_::Cell_descriptor& cell, typename Domain_::Point& point) const { typedef typename Domain_::Point Point; typedef typename Domain_::Geom_traits::Vector_3 Vector; @@ -90,8 +90,8 @@ public: const auto& p0 = domain.position(v0); const auto& p1 = domain.position(v1); - if ((val0 <= iso_value) != (val1 <= iso_value)) { // this edge is intersected by the isosurface - const FT u = (val0 - iso_value) / (val0 - val1); + if ((val0 <= isovalue) != (val1 <= isovalue)) { // this edge is intersected by the isosurface + const FT u = (val0 - isovalue) / (val0 - val1); const Point p_lerp = CGAL::ORIGIN + ((1 - u) * (p0 - CGAL::ORIGIN) + u * (p1 - CGAL::ORIGIN)); edge_intersections.push_back(p_lerp); edge_intersection_normals.push_back(domain.gradient(p_lerp)); @@ -164,14 +164,14 @@ public: * \tparam Domain_ must be a model of `IsosurfacingDomainWithGradient`. * * \param domain the domain providing input data and its topology - * \param iso_value value of the isosurface + * \param isovalue value of the isosurface * \param cell the cell within the domain for which the vertex position ins computed * \param point the point position of the vertex that belongs to that cell * * \return true, if the voxel intersects the isosurface */ template - bool position(const Domain_& domain, const typename Domain_::FT iso_value, + bool position(const Domain_& domain, const typename Domain_::FT isovalue, const typename Domain_::Cell_descriptor& vh, typename Domain_::Point& point) const { typedef typename Domain_::Point Point; typedef typename Domain_::Geom_traits::Vector_3 Vector; @@ -188,7 +188,7 @@ public: bool allSmaller = true; bool allGreater = true; for (const auto& v : vertices) { - const bool& b = domain.value(v) <= iso_value; + const bool& b = domain.value(v) <= isovalue; allSmaller = allSmaller && b; allGreater = allGreater && !b; } @@ -218,14 +218,14 @@ public: * \tparam Domain_ must be a model of `IsosurfacingDomainWithGradient`. * * \param domain the domain providing input data and its topology - * \param iso_value value of the isosurface + * \param isovalue value of the isosurface * \param cell the cell within the domain for which the vertex position ins computed * \param point the point position of the vertex that belongs to that cell * * \return true, if the voxel intersects the isosurface */ template - bool position(const Domain_& domain, const typename Domain_::FT iso_value, + bool position(const Domain_& domain, const typename Domain_::FT isovalue, const typename Domain_::Cell_descriptor& cell, typename Domain_::Point& point) const { typedef typename Domain_::Point Point; typedef typename Domain_::Geom_traits::Vector_3 Vector; @@ -247,8 +247,8 @@ public: const auto& p0 = domain.position(v0); const auto& p1 = domain.position(v1); - if ((val0 <= iso_value) != (val1 <= iso_value)) { // this edge is intersected by the isosurface - const FT u = (val0 - iso_value) / (val0 - val1); + if ((val0 <= isovalue) != (val1 <= isovalue)) { // this edge is intersected by the isosurface + const FT u = (val0 - isovalue) / (val0 - val1); const Point p_lerp = CGAL::ORIGIN + ((1 - u) * (p0 - CGAL::ORIGIN) + u * (p1 - CGAL::ORIGIN)); edge_intersections.push_back(p_lerp); } @@ -277,13 +277,13 @@ private: typedef typename Domain::Cell_descriptor Cell_descriptor; public: - Dual_contouring_vertex_positioning(const Domain& domain, FT iso_value, const Positioning& positioning) - : domain(domain), iso_value(iso_value), positioning(positioning), points_counter(0) {} + Dual_contouring_vertex_positioning(const Domain& domain, FT isovalue, const Positioning& positioning) + : domain(domain), isovalue(isovalue), positioning(positioning), points_counter(0) {} void operator()(const Cell_descriptor& v) { // compute dc-vertices Point p; - if (positioning.position(domain, iso_value, v, p)) { + if (positioning.position(domain, isovalue, v, p)) { std::lock_guard lock(mutex); map_voxel_to_point[v] = p; @@ -293,7 +293,7 @@ public: // private: const Domain& domain; - FT iso_value; + FT isovalue; const Positioning& positioning; std::map map_voxel_to_point_id; @@ -313,7 +313,7 @@ private: typedef typename Domain_::Cell_descriptor Cell_descriptor; public: - Dual_contouring_face_generation(const Domain& domain, FT iso_value) : domain(domain), iso_value(iso_value) {} + Dual_contouring_face_generation(const Domain& domain, FT isovalue) : domain(domain), isovalue(isovalue) {} void operator()(const Edge_descriptor& e) { // save all faces @@ -321,13 +321,13 @@ public: const FT s0 = domain.value(vertices[0]); const FT s1 = domain.value(vertices[1]); - if (s0 <= iso_value && s1 > iso_value) { + if (s0 <= isovalue && s1 > isovalue) { const auto& voxels = domain.cells_incident_to_edge(e); std::lock_guard lock(mutex); faces[e].insert(faces[e].begin(), voxels.begin(), voxels.end()); - } else if (s1 <= iso_value && s0 > iso_value) { + } else if (s1 <= isovalue && s0 > isovalue) { const auto& voxels = domain.cells_incident_to_edge(e); std::lock_guard lock(mutex); @@ -339,7 +339,7 @@ public: std::map> faces; const Domain& domain; - FT iso_value; + FT isovalue; std::mutex mutex; }; diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Marching_cubes_3_internal.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Marching_cubes_3_internal.h index 95c7e86be2f..c77c6ff984c 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Marching_cubes_3_internal.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Marching_cubes_3_internal.h @@ -60,9 +60,9 @@ namespace CGAL { namespace Isosurfacing { namespace internal { -// Interpolate linearly between two vertex positions v0, v1 with values d0 and d1 according to the iso_value +// Interpolate linearly between two vertex positions v0, v1 with values d0 and d1 according to the isovalue template -Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0, const FT d1, const FT iso_value) { +Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0, const FT d1, const FT isovalue) { FT mu; @@ -70,7 +70,7 @@ Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0, if (abs(d1 - d0) < 0.000001) { mu = 0.5; // if both points have the same value, assume isolevel is in the middle } else { - mu = (iso_value - d0) / (d1 - d0); + mu = (isovalue - d0) / (d1 - d0); } assert(mu >= 0.0 || mu <= 1.0); @@ -82,7 +82,7 @@ Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0, // Retrieve the corner vertices and their values of a cell and return the lookup index template std::size_t get_cell_corners(const Domain_& domain, const typename Domain_::Cell_descriptor& cell, - const typename Domain_::FT iso_value, Corners_& corners, Values_& values) { + const typename Domain_::FT isovalue, Corners_& corners, Values_& values) { typedef typename Domain_::Vertex_descriptor Vertex_descriptor; @@ -94,7 +94,7 @@ std::size_t get_cell_corners(const Domain_& domain, const typename Domain_::Cell corners[v_id] = domain.position(v); values[v_id] = domain.value(v); - if (values[v_id] >= iso_value) { + if (values[v_id] >= isovalue) { index.set(v_id); } // next cell vertex @@ -106,7 +106,7 @@ std::size_t get_cell_corners(const Domain_& domain, const typename Domain_::Cell // Create the vertices on the edges of one cell template -void mc_construct_vertices(const CellEdges& cell_edges, const FT iso_value, const std::size_t i_case, +void mc_construct_vertices(const CellEdges& cell_edges, const FT isovalue, const std::size_t i_case, const Corners_& corners, const Values_& values, Vertices_& vertices) { // compute for this case the vertices @@ -123,7 +123,7 @@ void mc_construct_vertices(const CellEdges& cell_edges, const FT iso_value, cons const int v0 = Cube_table::edge_to_vertex[e_id][0]; const int v1 = Cube_table::edge_to_vertex[e_id][1]; - vertices[e_id] = vertex_interpolation(corners[v0], corners[v1], values[v0], values[v1], iso_value); + vertices[e_id] = vertex_interpolation(corners[v0], corners[v1], values[v0], values[v1], isovalue); } flag <<= 1; e_id++; @@ -181,7 +181,7 @@ private: public: // Create a Marching Cubes functor for a domain and iso value - Marching_cubes_3(const Domain& domain, const FT iso_value) : domain(domain), iso_value(iso_value) {} + Marching_cubes_3(const Domain& domain, const FT isovalue) : domain(domain), isovalue(isovalue) {} // Compute one cell void operator()(const Cell_descriptor& cell) { @@ -192,7 +192,7 @@ public: FT values[8]; Point corners[8]; - const int i_case = get_cell_corners(domain, cell, iso_value, corners, values); + const int i_case = get_cell_corners(domain, cell, isovalue, corners, values); const int all_bits_set = (1 << (8 + 1)) - 1; // last 8 bits are 1 if (i_case == 0 || i_case == all_bits_set) { @@ -200,7 +200,7 @@ public: } std::array vertices; - mc_construct_vertices(domain.cell_edges(cell), iso_value, i_case, corners, values, vertices); + mc_construct_vertices(domain.cell_edges(cell), isovalue, i_case, corners, values, vertices); mc_construct_triangles(i_case, vertices, triangle_list); } @@ -212,7 +212,7 @@ public: private: const Domain& domain; - FT iso_value; + FT isovalue; Triangle_list triangle_list; }; diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tmc_internal.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tmc_internal.h index 547252a3f3f..9a4a7da8e96 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tmc_internal.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Tmc_internal.h @@ -72,14 +72,14 @@ private: typedef unsigned int uint; public: - TMC_functor(const Domain& domain, const FT iso_value, Point_range& points, Polygon_range& polygons) - : domain(domain), iso_value(iso_value), points(points), polygons(polygons) {} + TMC_functor(const Domain& domain, const FT isovalue, Point_range& points, Polygon_range& polygons) + : domain(domain), isovalue(isovalue), points(points), polygons(polygons) {} void operator()(const Cell_descriptor& cell) { FT values[8]; Point corners[8]; - const int i_case = get_cell_corners(domain, cell, iso_value, corners, values); + const int i_case = get_cell_corners(domain, cell, isovalue, corners, values); const int all_bits_set = (1 << (8 + 1)) - 1; // last 8 bits are 1 if (Cube_table::intersected_edges[i_case] == 0 || Cube_table::intersected_edges[i_case] == all_bits_set) { @@ -89,12 +89,12 @@ public: // this is the only difference to mc int tcm = (int)Cube_table::t_ambig[i_case]; if (tcm == 105) { - p_slice(cell, iso_value, values, corners, i_case); + p_slice(cell, isovalue, values, corners, i_case); return; } std::array vertices; - mc_construct_vertices(domain.cell_edges(cell), iso_value, i_case, corners, values, vertices); + mc_construct_vertices(domain.cell_edges(cell), isovalue, i_case, corners, values, vertices); // TODO: improve triangle generation // construct triangles @@ -199,7 +199,7 @@ public: // compute oriented contours // A countour consists of segment at the faces connecting the intersection of the - // iso-surface with the edges. For each edge we store the edge to which the segment + // isosurface with the edges. For each edge we store the edge to which the segment // is outgoing and the edge from which the segment in comming. Therefore a contour // cab be reconstructed by connecting the edges in the direccion of the outgoing. // The contour is oriented in such a way, that the positive vertices are outside. @@ -954,7 +954,7 @@ public: private: const Domain& domain; - FT iso_value; + FT isovalue; Point_range& points; Polygon_range& polygons; diff --git a/Isosurfacing_3/include/CGAL/Marching_cubes_3.h b/Isosurfacing_3/include/CGAL/Marching_cubes_3.h index badb05a370f..c1b22dbdf7c 100644 --- a/Isosurfacing_3/include/CGAL/Marching_cubes_3.h +++ b/Isosurfacing_3/include/CGAL/Marching_cubes_3.h @@ -39,22 +39,22 @@ namespace Isosurfacing { * `RandomAccessContainer` and `BackInsertionSequence` whose value type is `std::size_t`. * * \param domain the domain providing input data and its topology - * \param iso_value value of the isosurface + * \param isovalue value of the isosurface * \param points points of the triangles in the created indexed face set * \param triangles each element in the vector describes a triangle using the indices of the points in `points` * \param topologically_correct decides whether the topologically correct variant of Marching Cubes should be used */ template -void marching_cubes(const Domain_& domain, const typename Domain_::FT iso_value, PointRange& points, +void marching_cubes(const Domain_& domain, const typename Domain_::FT isovalue, PointRange& points, TriangleRange& triangles, bool topologically_correct = true) { if (topologically_correct) { // run TMC and directly write the result to points and triangles - internal::TMC_functor functor(domain, iso_value, points, triangles); + internal::TMC_functor functor(domain, isovalue, points, triangles); domain.template iterate_cells(functor); } else { // run MC - internal::Marching_cubes_3 functor(domain, iso_value); + internal::Marching_cubes_3 functor(domain, isovalue); domain.template iterate_cells(functor); // copy the result to points and triangles internal::to_indexed_face_set(functor.triangles(), points, triangles); diff --git a/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp b/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp index 528e1a969ec..eb08a326b7b 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp @@ -12,8 +12,8 @@ struct Sphere_function { }; template -void run(const Domain_& domain, const FT iso_value, Point_range& points, Polygon_range& polygons) { - CGAL::Isosurfacing::marching_cubes(domain, iso_value, points, polygons); +void run(const Domain_& domain, const FT isovalue, Point_range& points, Polygon_range& polygons) { + CGAL::Isosurfacing::marching_cubes(domain, isovalue, points, polygons); } void test_implicit_sphere() {