This commit is contained in:
Mael Rouxel-Labbé 2024-01-15 16:46:01 +01:00
parent f78e9ce819
commit aadc08b6f2
14 changed files with 40 additions and 37 deletions

View File

@ -12,8 +12,10 @@ at a 3D query point (not necessarily a vertex) in space.
\cgalRefines `IsosurfacingDomain_3` \cgalRefines `IsosurfacingDomain_3`
\cgalHasModel `CGAL::Isosurfacing::Explicit_Cartesian_grid_domain_3` \cgalHasModelsBegin
\cgalHasModel `CGAL::Isosurfacing::Implicit_Cartesian_grid_domain_3` \cgalHasModels{CGAL::Isosurfacing::Explicit_Cartesian_grid_domain_3}
\cgalHasModels{CGAL::Isosurfacing::Implicit_Cartesian_grid_domain_3}
\cgalHasModelsEnd
*/ */
class IsosurfacingDomainWithGradient_3 class IsosurfacingDomainWithGradient_3
{ {

View File

@ -39,19 +39,19 @@ public:
typedef Geom_traits::Point_3 Point_3; typedef Geom_traits::Point_3 Point_3;
/*! /*!
A descriptor to uniquely identify a vertex. A descriptor that uniquely identifies a vertex.
Must be a model of the concepts `DefaultConstructible`, `CopyConstructible`, and `Assignable`. Must be a model of the concepts `DefaultConstructible`, `CopyConstructible`, and `Assignable`.
*/ */
typedef unspecified_type Vertex_descriptor; typedef unspecified_type Vertex_descriptor;
/*! /*!
A descriptor to uniquely identify an edge. A descriptor that uniquely identifies an edge.
Must be a model of the concepts `DefaultConstructible`, `CopyConstructible`, and `Assignable`. Must be a model of the concepts `DefaultConstructible`, `CopyConstructible`, and `Assignable`.
*/ */
typedef unspecified_type Edge_descriptor; typedef unspecified_type Edge_descriptor;
/*! /*!
A descriptor to uniquely identify a cell. A descriptor that uniquely identifies a cell.
Must be a model of the concepts `DefaultConstructible`, `CopyConstructible`, and `Assignable`. Must be a model of the concepts `DefaultConstructible`, `CopyConstructible`, and `Assignable`.
*/ */
typedef unspecified_type Cell_descriptor; typedef unspecified_type Cell_descriptor;
@ -88,42 +88,42 @@ public:
/// @{ /// @{
/*! /*!
gets the geometric traits returns the geometric traits.
*/ */
Geom_traits geom_traits(); Geom_traits geom_traits();
/*! /*!
gets the 3D position of the vertex `v` returns the 3D position of the vertex `v`.
*/ */
Point_3 point(const Vertex_descriptor& v) const; Point_3 point(const Vertex_descriptor& v) const;
/*! /*!
gets the value of the implicit field at the vertex `v` returns the value of the implicit field at the vertex `v`.
*/ */
FT value(const Vertex_descriptor& v) const; FT value(const Vertex_descriptor& v) const;
/*! /*!
gets the two vertices incident to the edge `e` returns the two vertices incident to the edge `e`.
*/ */
Vertices_incident_to_edge incident_vertices(const Edge_descriptor& e) const; Vertices_incident_to_edge incident_vertices(const Edge_descriptor& e) const;
/*! /*!
gets all cells incident to the edge `e` returns all the cells incident to the edge `e`.
*/ */
Cells_incident_to_edge incident_cells(const Edge_descriptor& e) const; Cells_incident_to_edge incident_cells(const Edge_descriptor& e) const;
/*! /*!
gets all vertices of the cell `c` returns all the vertices of the cell `c`.
*/ */
Cell_vertices cell_vertices(const Cell_descriptor& c) const; Cell_vertices cell_vertices(const Cell_descriptor& c) const;
/*! /*!
gets all edges of the cell `c` returns all the edges of the cell `c`.
*/ */
Cell_edges cell_edges(const Cell_descriptor& c) const; Cell_edges cell_edges(const Cell_descriptor& c) const;
/*! /*!
iterates over all vertices and calls the functor `f` on each one iterates over all vertices, and calls the functor `f` on each one.
\tparam ConcurrencyTag decides if the vertices are iterated sequentially or in parallel. \tparam ConcurrencyTag decides if the vertices are iterated sequentially or in parallel.
Can be either `CGAL::Sequential_tag`, `CGAL::Parallel_if_available_tag`, or `CGAL::Parallel_tag`. Can be either `CGAL::Sequential_tag`, `CGAL::Parallel_if_available_tag`, or `CGAL::Parallel_tag`.
@ -135,7 +135,7 @@ public:
void iterate_vertices(Functor& f) const; void iterate_vertices(Functor& f) const;
/*! /*!
iterates over all edges and calls the functor `f` on each one iterates over all edges, and calls the functor `f` on each one.
\tparam ConcurrencyTag decides if the edges are iterated sequentially or in parallel. \tparam ConcurrencyTag decides if the edges are iterated sequentially or in parallel.
Can be either `CGAL::Sequential_tag`, `CGAL::Parallel_if_available_tag`, or `CGAL::Parallel_tag`. Can be either `CGAL::Sequential_tag`, `CGAL::Parallel_if_available_tag`, or `CGAL::Parallel_tag`.
@ -147,7 +147,7 @@ public:
void iterate_edges(Functor& f) const; void iterate_edges(Functor& f) const;
/*! /*!
iterates over all cells and calls the functor `f` on each one iterates over all cells, and calls the functor `f` on each one.
\tparam ConcurrencyTag decides if the cells are iterated sequentially or in parallel. \tparam ConcurrencyTag decides if the cells are iterated sequentially or in parallel.
Can be either `CGAL::Sequential_tag`, `CGAL::Parallel_if_available_tag`, or `CGAL::Parallel_tag`. Can be either `CGAL::Sequential_tag`, `CGAL::Parallel_if_available_tag`, or `CGAL::Parallel_tag`.

View File

@ -6,7 +6,9 @@
The concept `IsosurfacingTraits_3` describes the set of requirements to be The concept `IsosurfacingTraits_3` describes the set of requirements to be
fulfilled by the traits class of a model of `IsosurfacingDomain_3`. fulfilled by the traits class of a model of `IsosurfacingDomain_3`.
\cgalHasModel All models of `Kernel`. \cgalHasModelsBegin
\cgalHasModelsBare{All models of the concept `Kernel`}
\cgalHasModelsEnd
*/ */
class IsosurfacingTraits_3 class IsosurfacingTraits_3
{ {

View File

@ -76,7 +76,7 @@ int main(int, char**)
Refine_one_eighth split_predicate(3, 5); Refine_one_eighth split_predicate(3, 5);
octree_wrap.refine(split_predicate); octree_wrap.refine(split_predicate);
auto sphere_function = [&](const Point& p) -> FT auto sphere_function = [](const Point& p) -> FT
{ {
return std::sqrt(p.x() * p.x() + p.y() * p.y() + p.z() * p.z()); return std::sqrt(p.x() * p.x() + p.y() * p.y() + p.z() * p.z());
}; };

View File

@ -30,7 +30,7 @@ int main(int, char**)
auto domain = CGAL::Isosurfacing::create_implicit_Cartesian_grid_domain<Kernel> auto domain = CGAL::Isosurfacing::create_implicit_Cartesian_grid_domain<Kernel>
(bbox, vec_spacing, sphere_function); (bbox, vec_spacing, sphere_function);
// points and triangles for the output indexed mesh // points and triangles for the output indexed soup
Point_range points; Point_range points;
Triangle_range triangles; Triangle_range triangles;

View File

@ -38,7 +38,7 @@ int main(int argc, char* argv[])
// create a domain from the grid // create a domain from the grid
auto domain = CGAL::Isosurfacing::create_explicit_Cartesian_grid_domain(grid); auto domain = CGAL::Isosurfacing::create_explicit_Cartesian_grid_domain(grid);
// prepare collections for the output indexed mesh // prepare collections for the output indexed soup
Point_range points; Point_range points;
Polygon_range polygons; Polygon_range polygons;

View File

@ -31,7 +31,7 @@ int main(int, char**)
auto domain = CGAL::Isosurfacing::create_implicit_Cartesian_grid_domain<Kernel> auto domain = CGAL::Isosurfacing::create_implicit_Cartesian_grid_domain<Kernel>
(bbox, vec_spacing, sphere_function); (bbox, vec_spacing, sphere_function);
// points and triangles for the output indexed mesh // points and triangles for the output indexed soup
Point_range points; Point_range points;
Triangle_range triangles; Triangle_range triangles;

View File

@ -59,7 +59,7 @@ using Explicit_Cartesian_grid_domain_3 =
* *
* \brief Creates a domain that can be used as input for isosurfacing algorithms. * \brief Creates a domain that can be used as input for isosurfacing algorithms.
* *
* \warning As the domain will keep a pointer to the `grid` object, users must ensure that * \warning The domain keeps a pointer to the `grid` object, hence users must ensure that
* the lifetime of the `grid` object exceeds that of the object returned by this function. * the lifetime of the `grid` object exceeds that of the object returned by this function.
* *
* \tparam GeomTraits must be a model of `IsosurfacingTraits_3`. * \tparam GeomTraits must be a model of `IsosurfacingTraits_3`.
@ -67,7 +67,7 @@ using Explicit_Cartesian_grid_domain_3 =
* `GeomTraits::Vector_3 operator()(const GeomTraits::Point_3& point) const`. * `GeomTraits::Vector_3 operator()(const GeomTraits::Point_3& point) const`.
* *
* \param grid the %Cartesian grid containing input data * \param grid the %Cartesian grid containing input data
* \param grad a function giving the value of the gradient of the implicit function at each discretization point * \param gradient a function giving the value of the gradient of the implicit function at each discretization point
* *
* \return a new `CGAL::Explicit_Cartesian_grid_domain_3` * \return a new `CGAL::Explicit_Cartesian_grid_domain_3`
*/ */
@ -76,14 +76,14 @@ template <typename GeomTraits,
typename Gradient = Zero_gradient> typename Gradient = Zero_gradient>
Explicit_Cartesian_grid_domain_3<Grid, Gradient> Explicit_Cartesian_grid_domain_3<Grid, Gradient>
create_explicit_Cartesian_grid_domain(const CGAL::Isosurfacing::Cartesian_grid_3<GeomTraits>& grid, create_explicit_Cartesian_grid_domain(const CGAL::Isosurfacing::Cartesian_grid_3<GeomTraits>& grid,
const Gradient& grad = Gradient()) const Gradient& gradient = Gradient())
#else #else
// Actual code enables passing more than just a Cartesian_grid_3 // Actual code enables passing more than just a Cartesian_grid_3
template <typename Grid, template <typename Grid,
typename Gradient = Zero_gradient> typename Gradient = Zero_gradient>
Explicit_Cartesian_grid_domain_3<Grid, Gradient> Explicit_Cartesian_grid_domain_3<Grid, Gradient>
create_explicit_Cartesian_grid_domain(const Grid& grid, create_explicit_Cartesian_grid_domain(const Grid& grid,
const Gradient& grad = Gradient()) const Gradient& gradient = Gradient())
#endif #endif
{ {
using Domain = Explicit_Cartesian_grid_domain_3<Grid, Gradient>; using Domain = Explicit_Cartesian_grid_domain_3<Grid, Gradient>;
@ -100,7 +100,7 @@ create_explicit_Cartesian_grid_domain(const Grid& grid,
const Geometry geom { grid }; const Geometry geom { grid };
const Function func { grid }; const Function func { grid };
return Domain{ topo, geom, func, grad, grid.geom_traits() }; return Domain{ topo, geom, func, gradient, grid.geom_traits() };
} }
} // namespace Isosurfacing } // namespace Isosurfacing

View File

@ -23,7 +23,7 @@ namespace Isosurfacing {
* \brief Class template for a gradient that is calculated using finite differences. * \brief Class template for a gradient that is calculated using finite differences.
* *
* \details This gradient function evaluates an implicit value function at six points * \details This gradient function evaluates an implicit value function at six points
* that are a given distance `delta` away from the queried point along the cartesian axes. * that are a given distance `delta` away from the queried point along the Cartesian axes.
* *
* \tparam GeomTraits must be a model of `Kernel`. * \tparam GeomTraits must be a model of `Kernel`.
* \tparam PointFunction the type of the implicit function. It must be a model of `CopyConstructible` and implement * \tparam PointFunction the type of the implicit function. It must be a model of `CopyConstructible` and implement

View File

@ -71,15 +71,15 @@ using Implicit_Cartesian_grid_domain_3 =
* less overall memory is required in comparison to an `Explicit_Cartesian_grid_domain_3`. * less overall memory is required in comparison to an `Explicit_Cartesian_grid_domain_3`.
* *
* \tparam GeomTraits must be a model of `IsosurfacingTraits_3`. * \tparam GeomTraits must be a model of `IsosurfacingTraits_3`.
* \tparam ImplicitFunction the type of the implicit function. It must be a model of `CopyConstructible` and implement * \tparam ImplicitFunction the type of the implicit function. It must be a model of `CopyConstructible`
* `GeomTraits::FT operator()(const GeomTraits::Point_3& point) const`. * and implement `GeomTraits::FT operator()(const GeomTraits::Point_3& point) const`.
* \tparam Gradient the type of the gradient functor. It must be a model of `CopyConstructible` and implement * \tparam Gradient the type of the gradient functor. It must be a model of `CopyConstructible` and implement
* `GeomTraits::Vector_3 operator()(const GeomTraits::Point_3& point) const`. * `GeomTraits::Vector_3 operator()(const GeomTraits::Point_3& point) const`.
* *
* \param bbox a bounding box that specifies the dimensions of the implicit function's domain * \param bbox a bounding box that specifies the dimensions of the implicit function's domain
* \param spacing the distance between discretization points * \param spacing the distance between discretization points
* \param point_function the implicit function giving the value of the implicit function at each discretization point * \param point_function the implicit function giving the value of the implicit function at each discretization point
* \param grad a function giving the value of the gradient of the implicit function at each discretization point * \param gradient a function giving the value of the gradient of the implicit function at each discretization point
* \param gt an instance of geometric traits * \param gt an instance of geometric traits
* *
* \return a new object of type `CGAL::Implicit_Cartesian_grid_domain_3` * \return a new object of type `CGAL::Implicit_Cartesian_grid_domain_3`
@ -93,7 +93,7 @@ Implicit_Cartesian_grid_domain_3<GeomTraits, ImplicitFunction, Gradient>
create_implicit_Cartesian_grid_domain(const Bbox_3& bbox, create_implicit_Cartesian_grid_domain(const Bbox_3& bbox,
const typename GeomTraits::Vector_3& spacing, const typename GeomTraits::Vector_3& spacing,
const ImplicitFunction& point_function, const ImplicitFunction& point_function,
const Gradient& grad = Gradient(), const Gradient& gradient = Gradient(),
const GeomTraits& gt = GeomTraits()) const GeomTraits& gt = GeomTraits())
{ {
using Domain = Implicit_Cartesian_grid_domain_3<GeomTraits, ImplicitFunction, Gradient>; using Domain = Implicit_Cartesian_grid_domain_3<GeomTraits, ImplicitFunction, Gradient>;
@ -121,7 +121,7 @@ create_implicit_Cartesian_grid_domain(const Bbox_3& bbox,
const Geometry geom { offset, spacing }; const Geometry geom { offset, spacing };
const Function func { geom, point_function }; const Function func { geom, point_function };
return Domain{ topo, geom, func, grad, gt }; return Domain{ topo, geom, func, gradient, gt };
} }
// @todo add an undocumented convenience overload with Vector_3<GeomTraits> to match CGAL kernels // @todo add an undocumented convenience overload with Vector_3<GeomTraits> to match CGAL kernels

View File

@ -27,7 +27,7 @@ namespace Isosurfacing {
/* /*
* \ingroup IS_Domains_grp * \ingroup IS_Domains_grp
* *
* \cgalModels `IsosurfacingDomainWithGradient_3` * \cgalModels{IsosurfacingDomainWithGradient_3}
* *
* \brief A domain that represents an octree that discretizes an implicit function. * \brief A domain that represents an octree that discretizes an implicit function.
* *
@ -83,7 +83,7 @@ template <typename Octree,
typename Gradient = Zero_gradient> typename Gradient = Zero_gradient>
auto create_implicit_octree_domain(const Octree& octree, auto create_implicit_octree_domain(const Octree& octree,
const ImplicitFunction& point_func, const ImplicitFunction& point_func,
const Gradient& grad = Gradient()) const Gradient& gradient = Gradient())
{ {
#endif #endif
using Domain = Implicit_octree_domain<Octree, ImplicitFunction, Gradient>; using Domain = Implicit_octree_domain<Octree, ImplicitFunction, Gradient>;
@ -97,7 +97,7 @@ auto create_implicit_octree_domain(const Octree& octree,
const Function func { geom, point_func }; const Function func { geom, point_func };
// @fixme Octree_wrapper's geom_traits() isn't octree's geom_traits()... // @fixme Octree_wrapper's geom_traits() isn't octree's geom_traits()...
return Domain{ topo, geom, func, grad, octree.geom_traits() }; return Domain{ topo, geom, func, gradient, octree.geom_traits() };
} }
} // namespace Isosurfacing } // namespace Isosurfacing

View File

@ -26,7 +26,7 @@ namespace Isosurfacing {
* *
* \tparam P the point type * \tparam P the point type
* *
* \details This gradient function can be used for Marching Cubes that does not require a gradient. * \details This gradient function can be useful when using Marching Cubes, which does not require the domain to have a gradient.
*/ */
struct Zero_gradient struct Zero_gradient
{ {

View File

@ -89,7 +89,7 @@ void dual_contouring(const Domain& domain,
vertex_ids.push_back(pos_func.map_voxel_to_point_id[v_id]); vertex_ids.push_back(pos_func.map_voxel_to_point_id[v_id]);
} }
// ignore degenerated faces // ignore degenerate faces
if(vertex_ids.size() > 2) if(vertex_ids.size() > 2)
polygons.push_back(vertex_ids); polygons.push_back(vertex_ids);
} }

View File

@ -20,7 +20,6 @@ namespace internal {
// Wrapper for an implicit function that can only be evaluated at a position and not at a vertex. // Wrapper for an implicit function that can only be evaluated at a position and not at a vertex.
// Evaluates the geometry to get the vertex position and passes that to the function. // Evaluates the geometry to get the vertex position and passes that to the function.
// Works for all VertexDescriptor types.
template <typename Geometry, template <typename Geometry,
typename PointFunction> typename PointFunction>
class Implicit_function_with_geometry class Implicit_function_with_geometry