mirror of https://github.com/CGAL/cgal
Added meshing parameter : initial_points
This commit is contained in:
parent
ca605fe57f
commit
ec7a6ac876
|
|
@ -407,7 +407,7 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false >
|
|||
* </UL>}
|
||||
* \cgalParamDefault{`parameters::exude()`}
|
||||
* \cgalParamSectionEnd
|
||||
* \cgalParamSectionBegin{Mesh initialization}
|
||||
* \cgalParamSectionBegin{Mesh initialization with a functor}
|
||||
* \cgalParamDescription{an `InitialPointsGenerator` can optionally be provided to start the meshing process.
|
||||
* It must follow the `InitialPointsGenerator` concept.
|
||||
* The following named parameter controls this option:
|
||||
|
|
@ -415,7 +415,24 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false >
|
|||
* <LI> `parameters::initial_points_generator()`
|
||||
* </UL>}
|
||||
* \cgalParamDefault{`CGAL::Null_Functor()`, the domain's `construct_initial_points_object()`
|
||||
* will be called for the points initialization.}
|
||||
* will be called for the points initialization.}
|
||||
* \cgalParamSectionBegin{Mesh initialization with points}
|
||||
* \cgalParamDescription{a `std::vector` of initial points, represented as
|
||||
* `std::vector<std::tuple<Weighted_point_3, int, Index>>` can optionally
|
||||
* be provided to start the meshing process.
|
||||
* `Weighted_point_3` is 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.
|
||||
* The following named parameter controls this option:
|
||||
* <UL>
|
||||
* <LI> `parameters::initial_points()`
|
||||
* </UL>}
|
||||
* \cgalParamDefault{`std::vector<std::tuple<Weighted_point_3, int, Index>>()`}
|
||||
* \cgalParamExtra{If this parameter is set,
|
||||
* the domain's `construct_initial_points_object()` will not be called.}
|
||||
* \cgalParamExtra{If the parameter `parameters::initial_points_generator()` is set,
|
||||
* the points will be inserted before calling the functor.}
|
||||
* \cgalParamSectionEnd
|
||||
* \cgalNamedParamsEnd
|
||||
*
|
||||
|
|
@ -444,6 +461,7 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C
|
|||
{
|
||||
using parameters::choose_parameter;
|
||||
using parameters::get_parameter;
|
||||
using parameters::get_parameter_reference;
|
||||
C3T3 c3t3;
|
||||
parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v);
|
||||
parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v);
|
||||
|
|
@ -453,9 +471,16 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C
|
|||
parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options());
|
||||
parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options());
|
||||
|
||||
parameters::internal::Initial_points_generator_options<MeshDomain, C3T3> initial_points_generator_options_param =
|
||||
parameters::internal::Initial_points_generator_generator<MeshDomain, C3T3>()
|
||||
(choose_parameter(get_parameter(np, internal_np::initial_points_generator_options_param), parameters::initial_points_generator().v));
|
||||
using Initial_points_generator_generator = parameters::internal::Initial_points_generator_generator<MeshDomain, C3T3>;
|
||||
using Initial_points = typename Initial_points_generator_generator::Initial_points;
|
||||
Initial_points empty_vec;
|
||||
const Initial_points& initial_points
|
||||
= choose_parameter(get_parameter_reference(np, internal_np::initial_points_param), empty_vec);
|
||||
parameters::internal::Initial_points_generator_options initial_points_generator_options_param =
|
||||
Initial_points_generator_generator()
|
||||
(choose_parameter(get_parameter(np, internal_np::initial_points_generator_options_param),
|
||||
parameters::initial_points_generator().v),
|
||||
initial_points);
|
||||
|
||||
make_mesh_3_impl(c3t3, domain, criteria,
|
||||
exude_param, perturb_param, odt_param, lloyd_param,
|
||||
|
|
|
|||
|
|
@ -175,31 +175,54 @@ struct Initial_points_generator_options
|
|||
{
|
||||
typedef typename C3t3::Triangulation::Geom_traits::Weighted_point_3 Weighted_point_3;
|
||||
typedef typename MeshDomain::Index Index;
|
||||
typedef typename std::back_insert_iterator<std::vector<std::tuple<Weighted_point_3, int, Index>>> OutputIterator;
|
||||
typedef typename std::vector<std::tuple<Weighted_point_3, int, Index>> Initial_points;
|
||||
typedef typename std::back_insert_iterator<Initial_points> OutputIterator;
|
||||
|
||||
template <typename Initial_points_generator>
|
||||
Initial_points_generator_options(const Initial_points_generator& generator, bool is_default = false)
|
||||
Initial_points_generator_options(const Initial_points_generator& generator, const Initial_points& initial_points, bool is_default = false)
|
||||
: initial_points_generator_no_number_of_points_(generator)
|
||||
, initial_points_generator_(generator)
|
||||
, is_default_(is_default)
|
||||
{ }
|
||||
, is_default_(is_default && initial_points.size() == 0)
|
||||
{
|
||||
if (initial_points.size() == 0)
|
||||
{
|
||||
initial_points_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
initial_points_ = &initial_points;
|
||||
}
|
||||
}
|
||||
|
||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3) const
|
||||
{
|
||||
add_initial_points(pts);
|
||||
return initial_points_generator_no_number_of_points_(pts, domain, c3t3);
|
||||
}
|
||||
|
||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n) const
|
||||
{
|
||||
add_initial_points(pts);
|
||||
return initial_points_generator_(pts, domain, c3t3, n);
|
||||
}
|
||||
|
||||
OutputIterator add_initial_points(OutputIterator pts) const
|
||||
{
|
||||
if (initial_points_ != nullptr)
|
||||
{
|
||||
for (const auto& point_tuple : *initial_points_)
|
||||
*pts++ = point_tuple;
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
|
||||
bool is_default() const { return is_default_; }
|
||||
|
||||
private:
|
||||
const bool is_default_;
|
||||
const std::function<OutputIterator(OutputIterator&,const MeshDomain&,const C3t3&)> initial_points_generator_no_number_of_points_;
|
||||
const std::function<OutputIterator(OutputIterator&,const MeshDomain&,const C3t3&,int)> initial_points_generator_;
|
||||
const Initial_points* initial_points_;
|
||||
const bool is_default_;
|
||||
};
|
||||
|
||||
// -----------------------------------
|
||||
|
|
@ -249,11 +272,9 @@ struct Domain_features_generator< MeshDomain, true >
|
|||
template <typename MeshDomain, typename C3t3>
|
||||
struct Initial_points_generator_generator
|
||||
{
|
||||
typedef typename C3t3::Triangulation::Geom_traits::Weighted_point_3 Weighted_point_3;
|
||||
typedef typename MeshDomain::Index Index;
|
||||
typedef typename std::back_insert_iterator<std::vector<std::tuple<Weighted_point_3, int, Index>>> OutputIterator;
|
||||
|
||||
typedef typename CGAL::parameters::internal::Initial_points_generator_options<MeshDomain, C3t3> Initial_points_generator_options;
|
||||
typedef typename Initial_points_generator_options::Initial_points Initial_points;
|
||||
typedef typename Initial_points_generator_options::OutputIterator OutputIterator;
|
||||
|
||||
struct Initial_points_generator_domain_traductor
|
||||
{
|
||||
|
|
@ -283,20 +304,42 @@ struct Initial_points_generator_generator
|
|||
}
|
||||
};
|
||||
|
||||
template <typename InitialPointsGenerator>
|
||||
Initial_points_generator_options operator()(const InitialPointsGenerator& initial_points_generator)
|
||||
struct Initial_points_generator_empty
|
||||
{
|
||||
return Initial_points_generator_options(initial_points_generator, false);
|
||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3)
|
||||
{ return pts; }
|
||||
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n)
|
||||
{ return pts; }
|
||||
};
|
||||
|
||||
// With a custom InitialPointsGenerator
|
||||
template <typename InitialPointsGenerator, typename InitalPointsRange>
|
||||
Initial_points_generator_options operator()(const InitialPointsGenerator& initial_points_generator, const InitalPointsRange& input_features)
|
||||
{
|
||||
return Initial_points_generator_options(initial_points_generator, input_features, false);
|
||||
}
|
||||
|
||||
Initial_points_generator_options operator()(const Null_functor&)
|
||||
// Without a custom InitialPointsGenerator
|
||||
template <typename InitalPointsRange>
|
||||
Initial_points_generator_options operator()(const InitalPointsRange& input_features)
|
||||
{
|
||||
return operator()();
|
||||
// The domain's construct_initial_points_object is called only if input_features is empty
|
||||
if (input_features.size() == 0) {
|
||||
return Initial_points_generator_options(Initial_points_generator_domain_traductor(), input_features, true);
|
||||
}
|
||||
return Initial_points_generator_options(Initial_points_generator_empty(), input_features, true);
|
||||
}
|
||||
|
||||
template <typename InitalPointsRange>
|
||||
Initial_points_generator_options operator()(const Null_functor&, const InitalPointsRange& input_features)
|
||||
{
|
||||
return operator()(input_features);
|
||||
}
|
||||
|
||||
Initial_points_generator_options operator()()
|
||||
{
|
||||
return Initial_points_generator_options(Initial_points_generator_domain_traductor(), true);
|
||||
Initial_points empty_input_features;
|
||||
return operator()(empty_input_features);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ CGAL_add_named_parameter_with_compatibility(mesh_param_t, mesh_param, mesh_optio
|
|||
CGAL_add_named_parameter_with_compatibility(manifold_param_t, manifold_param, manifold_option)
|
||||
CGAL_add_named_parameter_with_compatibility(features_option_param_t,features_options_param,features_options)
|
||||
CGAL_add_named_parameter_with_compatibility(initial_points_generator_options_param_t,initial_points_generator_options_param,initial_points_generator_options)
|
||||
CGAL_add_named_parameter_with_compatibility(initial_points_param_t,initial_points_param,initial_points)
|
||||
|
||||
CGAL_add_named_parameter_with_compatibility_cref_only(image_3_param_t, image_3_param, image)
|
||||
CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue