mirror of https://github.com/CGAL/cgal
Merge branch 'Mesh-3-rework-make-mesh-point-initialization-2-aclement' of https://github.com/ange-clement/cgal into Mesh-3-rework-make-mesh-point-initialization-2-aclement
This commit is contained in:
commit
50dfc18d4a
|
|
@ -454,22 +454,16 @@ unspecified_type perturb(const Named_function_parameters& np = parameters::defau
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgMesh3Parameters
|
* \ingroup PkgMesh3Parameters
|
||||||
*
|
*
|
||||||
* The function `parameters::initial_points_generator()` enables the user to
|
* The function `parameters::initial_points_generator()` allows the user to specify a functor that follows the `InitialPointsGenerator` concept to the mesh generation function `make_mesh_3()`. This functor will be called for the initialization of the meshing process. If this parameter is specified without arguments, the default behavior is executed, which calls the domain's `construct_initial_points_object()` for the initialization of the meshing process.
|
||||||
* specify a functor following the `InitialPointsGenerator` concept
|
|
||||||
* to the mesh generation function `make_mesh_3()`.
|
|
||||||
* The functor will be called for initialization of the meshing process.
|
|
||||||
* If this parameter is specified without arguments, the default behavior is executed,
|
|
||||||
* i.e. the domain's `construct_initial_points_object()`
|
|
||||||
* is called for the initialization of the meshing process.
|
|
||||||
*
|
*
|
||||||
* \tparam InitialPointsGenerator a functor following the `InitialPointsGenerator` concept
|
* \tparam InitialPointsGenerator a functor that follows the `InitialPointsGenerator` concept
|
||||||
*
|
*
|
||||||
* @param generator an instance of the InitialPointsGenerator functor
|
* @param generator an instance of the InitialPointsGenerator functor
|
||||||
*
|
*
|
||||||
* \cgalHeading{Example}
|
* \cgalHeading{Example}
|
||||||
*
|
*
|
||||||
* \code{.cpp}
|
* \code{.cpp}
|
||||||
* // Mesh generation from labeled image with connexity checks.
|
* // Mesh generation from a labeled image with connexity checks.
|
||||||
* C3t3 c3t3 = make_mesh_3<c3t3>(domain,
|
* C3t3 c3t3 = make_mesh_3<c3t3>(domain,
|
||||||
* criteria,
|
* criteria,
|
||||||
* parameters::initial_points_generator(CGAL::Construct_initial_points_labeled_image(image)));
|
* parameters::initial_points_generator(CGAL::Construct_initial_points_labeled_image(image)));
|
||||||
|
|
@ -485,30 +479,22 @@ unspecified_type initial_points_generator(const InitialPointsGenerator& generato
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgMesh3Parameters
|
* \ingroup PkgMesh3Parameters
|
||||||
*
|
*
|
||||||
* The function `parameters::initial_points()` enables the user to
|
* The function `parameters::initial_points()` allows the user to specify a container model of `Range` that contains initial points to be used in the `make_mesh_3()` function for mesh generation. The `Range` should have elements of type `std::tuple<Weighted_point_3, int, Index>`, where `Weighted_point_3` represents the position and weight of the point, `int` represents the dimension of the minimal subcomplex on which the point lies, and `Index` represents the underlying subcomplex index.
|
||||||
* specify a container model of `Range` of initial points
|
|
||||||
* to the mesh generation function `make_mesh_3()`.
|
|
||||||
* The initial points `Range` has elements of type
|
|
||||||
* `std::tuple<Weighted_point_3, int, Index>` where
|
|
||||||
* `Weighted_point_3` contains the point's position and weight,
|
|
||||||
* `int` is the dimension of the minimal dimension subcomplex on which the point lies, and
|
|
||||||
* `Index` is the underlying subcomplex index.
|
|
||||||
*
|
*
|
||||||
* \tparam MeshDomain model of `MeshDomain_3`
|
* \tparam MeshDomain a model of `MeshDomain_3`
|
||||||
* \tparam C3t3 model of `MeshComplex_3InTriangulation_3`
|
* \tparam C3t3 a model of `MeshComplex_3InTriangulation_3`
|
||||||
*
|
*
|
||||||
* @param initial_points a `Range` containing points of type
|
* @param initial_points a `Range` that contains points of type `std::tuple<C3t3::Triangulation::Geom_traits::Weighted_point_3, int, MeshDomain::Index>`
|
||||||
* `std::tuple<C3t3::Triangulation::Geom_traits::Weighted_point_3, int, MeshDomain::Index>`
|
|
||||||
*
|
*
|
||||||
* \cgalHeading{Example}
|
* \cgalHeading{Example}
|
||||||
*
|
*
|
||||||
* \code{.cpp}
|
* \code{.cpp}
|
||||||
* // Creation of the initial_points vector
|
* // Create the initial_points vector
|
||||||
* std::vector<std::tuple<K::Weighted_point_3, int, Mesh_domain::Index>> initial_points;
|
* std::vector<std::tuple<K::Weighted_point_3, int, Mesh_domain::Index>> initial_points;
|
||||||
* // Mesh generation from labeled image with initial points.
|
* // Perform mesh generation from a labeled image with initial points
|
||||||
* C3t3 c3t3 = make_mesh_3<c3t3>(domain,
|
* C3t3 c3t3 = make_mesh_3<c3t3>(domain,
|
||||||
* criteria,
|
* criteria,
|
||||||
* parameters::initial_points(std::cref(initial_points));//use std::cref to avoid a copy
|
* parameters::initial_points(std::cref(initial_points))); // Use std::cref to avoid a copy
|
||||||
* \endcode
|
* \endcode
|
||||||
*
|
*
|
||||||
* \sa `CGAL::parameters::initial_points_generator()`
|
* \sa `CGAL::parameters::initial_points_generator()`
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ The following functors are available for mesh initialization:
|
||||||
- `CGAL::odt_optimize_mesh_3()`
|
- `CGAL::odt_optimize_mesh_3()`
|
||||||
- `CGAL::Mesh_3::generate_label_weights()`
|
- `CGAL::Mesh_3::generate_label_weights()`
|
||||||
|
|
||||||
\cgalCRPSection{CGAL::parameters Functions}
|
\cgalCRPSection{%CGAL::parameters Functions}
|
||||||
|
|
||||||
- `CGAL::parameters::features()`
|
- `CGAL::parameters::features()`
|
||||||
- `CGAL::parameters::no_features()`
|
- `CGAL::parameters::no_features()`
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ struct Custom_Initial_points_generator
|
||||||
Custom_Initial_points_generator(CGAL::Image_3& image) : image_(image) { }
|
Custom_Initial_points_generator(CGAL::Image_3& image) : image_(image) { }
|
||||||
|
|
||||||
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
||||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n = 1) const
|
OutputIterator operator()(OutputIterator pts, const MeshDomain& /* domain */, const C3t3& c3t3, int /* n */ = 1) const
|
||||||
{
|
{
|
||||||
typedef typename C3t3::Triangulation::Geom_traits::Point_3 Point_3;
|
typedef typename C3t3::Triangulation::Geom_traits::Point_3 Point_3;
|
||||||
typedef typename C3t3::Triangulation::Geom_traits::Vector_3 Vector_3;
|
typedef typename C3t3::Triangulation::Geom_traits::Vector_3 Vector_3;
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,17 @@ namespace CGAL
|
||||||
{
|
{
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgMesh3Initializers
|
* \ingroup PkgMesh3Initializers
|
||||||
*
|
*
|
||||||
* Functor for initial points generation in gray images.
|
* Functor for generating initial points in gray images.
|
||||||
* This functor is a model of concept `InitialPointsGenerator`,
|
* This functor is a model of the `InitialPointsGenerator` concept,
|
||||||
* and thus can be passed to `CGAL::make_mesh_3` with the parameter
|
* and can be passed as a parameter to `CGAL::make_mesh_3` using the
|
||||||
* `CGAL::parameters::initial_points_generator()`
|
* `CGAL::parameters::initial_points_generator()` parameter function.
|
||||||
*
|
*
|
||||||
* \sa `CGAL::parameters::initial_points_generator()`
|
* \sa `CGAL::parameters::initial_points_generator()`
|
||||||
* \sa `CGAL::make_mesh_3()`
|
* \sa `CGAL::make_mesh_3()`
|
||||||
* \sa `CGAL::Construct_initial_points_labeled_image`
|
* \sa `CGAL::Construct_initial_points_labeled_image`
|
||||||
*/
|
*/
|
||||||
template <typename Functor = CGAL::Null_functor>
|
template <typename Functor = CGAL::Null_functor>
|
||||||
struct Construct_initial_points_gray_image
|
struct Construct_initial_points_gray_image
|
||||||
{
|
{
|
||||||
|
|
@ -50,14 +50,13 @@ struct Construct_initial_points_gray_image
|
||||||
, iso_value_(iso_value)
|
, iso_value_(iso_value)
|
||||||
, image_values_to_subdomain_indices_(image_values_to_subdomain_indices)
|
, image_values_to_subdomain_indices_(image_values_to_subdomain_indices)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructs the initial points using the gray image.
|
* \brief Constructs the initial points using the gray image.
|
||||||
*
|
*
|
||||||
* @tparam OutputIterator an `OutputIterator` of points of type
|
* \tparam OutputIterator An `OutputIterator` of points of type
|
||||||
* `std::tuple<MeshDomain::Point_3, int, MeshDomain::Index>`
|
* `std::tuple<MeshDomain::Point_3, int, MeshDomain::Index>`.
|
||||||
* @tparam MeshDomain a model of `MeshDomain_3`
|
* \tparam MeshDomain A model of `MeshDomain_3`.
|
||||||
* @tparam C3t3 a model of `MeshComplex_3InTriangulation_3`
|
* \tparam C3t3 A model of `MeshComplex_3InTriangulation_3`.
|
||||||
*/
|
*/
|
||||||
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
||||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n = 20) const
|
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n = 20) const
|
||||||
|
|
|
||||||
|
|
@ -71,17 +71,17 @@ struct Get_point
|
||||||
} // end namespace Mesh_3
|
} // end namespace Mesh_3
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgMesh3Initializers
|
* \ingroup PkgMesh3Initializers
|
||||||
*
|
*
|
||||||
* Functor for initial points generation in labeled images.
|
* Functor for generating initial points in labeled images.
|
||||||
* This functor is a model of concept `InitialPointsGenerator`,
|
* This functor is a model of the `InitialPointsGenerator` concept,
|
||||||
* and thus can be passed to `CGAL::make_mesh_3` with the parameter
|
* and can be passed as a parameter to `CGAL::make_mesh_3` using the
|
||||||
* `CGAL::parameters::initial_points_generator()`
|
* `CGAL::parameters::initial_points_generator()` function.
|
||||||
*
|
*
|
||||||
* \sa `CGAL::parameters::initial_points_generator()`
|
* \sa `CGAL::parameters::initial_points_generator()`
|
||||||
* \sa `CGAL::make_mesh_3()`
|
* \sa `CGAL::make_mesh_3()`
|
||||||
* \sa `CGAL::Construct_initial_points_gray_image`
|
* \sa `CGAL::Construct_initial_points_gray_image`
|
||||||
*/
|
*/
|
||||||
struct Construct_initial_points_labeled_image
|
struct Construct_initial_points_labeled_image
|
||||||
{
|
{
|
||||||
const CGAL::Image_3 & image;
|
const CGAL::Image_3 & image;
|
||||||
|
|
@ -91,13 +91,13 @@ struct Construct_initial_points_labeled_image
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructs points by collecting them in all connected components.
|
* \brief Constructs points by collecting them from all connected components.
|
||||||
* This guarantees to initialize them all.
|
* This ensures that all points are initialized.
|
||||||
*
|
*
|
||||||
* @tparam OutputIterator model of `OutputIterator`, containing points of type
|
* @tparam OutputIterator a model of `OutputIterator` that contains points of type
|
||||||
* `std::tuple<MeshDomain::Point_3, int, MeshDomain::Index>`
|
* `std::tuple<MeshDomain::Point_3, int, MeshDomain::Index>`
|
||||||
* @tparam MeshDomain model of `MeshDomain_3`
|
* @tparam MeshDomain a model of `MeshDomain_3`
|
||||||
* @tparam C3t3 model of `MeshComplex_3InTriangulation_3`
|
* @tparam C3t3 a model of `MeshComplex_3InTriangulation_3`
|
||||||
*/
|
*/
|
||||||
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
||||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n = 20) const
|
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n = 20) const
|
||||||
|
|
@ -107,18 +107,18 @@ struct Construct_initial_points_labeled_image
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Same as above, but a `TransformOperator` is used
|
* \brief Same as above, but a `TransformOperator` is used.
|
||||||
*
|
*
|
||||||
* @tparam OutputIterator model of `OutputIterator`, containing points of type
|
* @tparam OutputIterator A model of `OutputIterator` that contains points of type
|
||||||
* `std::tuple<MeshDomain::Point_3, int, MeshDomain::Index>`
|
* `std::tuple<MeshDomain::Point_3, int, MeshDomain::Index>`.
|
||||||
* @tparam MeshDomain model of `MeshDomain_3`
|
* @tparam MeshDomain A model of `MeshDomain_3`.
|
||||||
* @tparam TransformOperator functor that transforms values of the image.
|
* @tparam TransformOperator A functor that transforms values of the image.
|
||||||
* It must provide the following type:<br>
|
* It must provide the following type:<br>
|
||||||
* `result_type`<br>
|
* `result_type`<br>
|
||||||
* and the following operator:<br>
|
* and the following operator:<br>
|
||||||
* `template<typename FT>`<br>
|
* `template<typename FT>`<br>
|
||||||
* `result_type operator()(FT v)`
|
* `result_type operator()(FT v)`.
|
||||||
* @tparam C3t3 model of `MeshComplex_3InTriangulation_3`
|
* @tparam C3t3 A model of `MeshComplex_3InTriangulation_3`.
|
||||||
*/
|
*/
|
||||||
template <typename OutputIterator, typename MeshDomain, typename C3t3, typename TransformOperator>
|
template <typename OutputIterator, typename MeshDomain, typename C3t3, typename TransformOperator>
|
||||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, TransformOperator transform, const C3t3& c3t3, int n = 20) const
|
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, TransformOperator transform, const C3t3& c3t3, int n = 20) const
|
||||||
|
|
@ -187,10 +187,10 @@ struct Construct_initial_points_labeled_image
|
||||||
|
|
||||||
const double radius = double(seed.radius + 1)* max_v;
|
const double radius = double(seed.radius + 1)* max_v;
|
||||||
CGAL::Random_points_on_sphere_3<Point_3> points_on_sphere_3(radius);
|
CGAL::Random_points_on_sphere_3<Point_3> points_on_sphere_3(radius);
|
||||||
/// \noop [construct intersection]
|
// [construct intersection]
|
||||||
typename MeshDomain::Construct_intersection construct_intersection =
|
typename MeshDomain::Construct_intersection construct_intersection =
|
||||||
domain.construct_intersection_object();
|
domain.construct_intersection_object();
|
||||||
/// \noop [construct intersection]
|
// [construct intersection]
|
||||||
|
|
||||||
std::vector<Vector_3> directions;
|
std::vector<Vector_3> directions;
|
||||||
if(seed.radius < 2) {
|
if(seed.radius < 2) {
|
||||||
|
|
@ -214,16 +214,16 @@ struct Construct_initial_points_labeled_image
|
||||||
const Point_3 test = seed_point + v;
|
const Point_3 test = seed_point + v;
|
||||||
const Segment_3 test_segment = Segment_3(seed_point, test);
|
const Segment_3 test_segment = Segment_3(seed_point, test);
|
||||||
|
|
||||||
/// \noop [use construct intersection]
|
// [use construct intersection]
|
||||||
const typename MeshDomain::Intersection intersect =
|
const typename MeshDomain::Intersection intersect =
|
||||||
construct_intersection(test_segment);
|
construct_intersection(test_segment);
|
||||||
/// \noop [use construct intersection]
|
// [use construct intersection]
|
||||||
if (std::get<2>(intersect) != 0)
|
if (std::get<2>(intersect) != 0)
|
||||||
{
|
{
|
||||||
/// \noop [get construct intersection]
|
// [get construct intersection]
|
||||||
const Point_3& intersect_point = std::get<0>(intersect);
|
const Point_3& intersect_point = std::get<0>(intersect);
|
||||||
const Index& intersect_index = std::get<1>(intersect);
|
const Index& intersect_index = std::get<1>(intersect);
|
||||||
/// \noop [get construct intersection]
|
// [get construct intersection]
|
||||||
Weighted_point pi = Weighted_point(intersect_point);
|
Weighted_point pi = Weighted_point(intersect_point);
|
||||||
|
|
||||||
// This would cause trouble to optimizers
|
// This would cause trouble to optimizers
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <CGAL/STL_Extension/internal/Has_features.h>
|
#include <CGAL/STL_Extension/internal/Has_features.h>
|
||||||
#include <boost/function_output_iterator.hpp>
|
#include <boost/iterator/function_output_iterator.hpp>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
|
@ -187,20 +187,20 @@ struct Input_const_iterator_container
|
||||||
public:
|
public:
|
||||||
Input_const_iterator_container(const Iterator& it) : it_(it) {}
|
Input_const_iterator_container(const Iterator& it) : it_(it) {}
|
||||||
|
|
||||||
virtual ~Input_const_iterator_container() {}
|
~Input_const_iterator_container() override {}
|
||||||
|
|
||||||
virtual const Value& operator*()
|
const Value& operator*() override
|
||||||
{
|
{
|
||||||
return *it_;
|
return *it_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Input_const_iterator_interface<Value>* operator++()
|
Input_const_iterator_interface<Value>* operator++() override
|
||||||
{
|
{
|
||||||
++it_;
|
++it_;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool operator!=(const Input_const_iterator_interface<Value>* other) const
|
bool operator!=(const Input_const_iterator_interface<Value>* other) const override
|
||||||
{
|
{
|
||||||
const Self* other_casted = dynamic_cast<const Self*>(other);
|
const Self* other_casted = dynamic_cast<const Self*>(other);
|
||||||
if (other_casted == nullptr)
|
if (other_casted == nullptr)
|
||||||
|
|
@ -208,7 +208,7 @@ public:
|
||||||
return it_ != other_casted->it_;
|
return it_ != other_casted->it_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Input_const_iterator_interface<Value>* clone()
|
Input_const_iterator_interface<Value>* clone() override
|
||||||
{
|
{
|
||||||
return new Input_const_iterator_container<Value, Iterator>(it_);
|
return new Input_const_iterator_container<Value, Iterator>(it_);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue