mirror of https://github.com/CGAL/cgal
Revision 1 :
Doc fix + Deleted default_initial_points_generation() + Created Construct_initial_points_gray_image.h
This commit is contained in:
parent
976e73cf89
commit
ec5539eac3
|
|
@ -451,29 +451,6 @@ unspecified_type odt(const Named_function_parameters& np = parameters::default_v
|
||||||
template <class NamedParameters = parameters::Default_named_parameters>
|
template <class NamedParameters = parameters::Default_named_parameters>
|
||||||
unspecified_type perturb(const Named_function_parameters& np = parameters::default_values());
|
unspecified_type perturb(const Named_function_parameters& np = parameters::default_values());
|
||||||
|
|
||||||
/*!
|
|
||||||
* \ingroup PkgMesh3Parameters
|
|
||||||
*
|
|
||||||
* The function `parameters::default_initial_points_generation()` enables the user to
|
|
||||||
* tell the mesh generation function `make_mesh_3()`
|
|
||||||
* that the domain's `construct_initial_points_object()`
|
|
||||||
* will be called for the points initialization.
|
|
||||||
*
|
|
||||||
* \cgalHeading{Example}
|
|
||||||
*
|
|
||||||
* \code{.cpp}
|
|
||||||
* // Mesh generation using the domlain's construct_initial_points_object
|
|
||||||
* C3t3 c3t3 = make_mesh_3<c3t3>(domain,
|
|
||||||
* criteria,
|
|
||||||
* parameters::default_initial_points_generation());
|
|
||||||
* \endcode
|
|
||||||
*
|
|
||||||
* \sa `CGAL::parameters::initial_points_generator()`
|
|
||||||
* \sa `CGAL::make_mesh_3()`
|
|
||||||
* \sa `MeshDomain_3::Construct_initial_points`
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
unspecified_type default_initial_points_generation();
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgMesh3Parameters
|
* \ingroup PkgMesh3Parameters
|
||||||
*
|
*
|
||||||
|
|
@ -481,6 +458,9 @@ unspecified_type default_initial_points_generation();
|
||||||
* specify a Functor of the `InitialPointsGenerator` concept
|
* specify a Functor of the `InitialPointsGenerator` concept
|
||||||
* to the mesh generation function `make_mesh_3()`.
|
* to the mesh generation function `make_mesh_3()`.
|
||||||
* The functor will be called for the points initialization.
|
* The functor will be called for the points initialization.
|
||||||
|
* If this parameter is specified without argument, the default behaviour is executed,
|
||||||
|
* i.e. the domain's `construct_initial_points_object()`
|
||||||
|
* will be called for the points initialization.
|
||||||
*
|
*
|
||||||
* \cgalHeading{Example}
|
* \cgalHeading{Example}
|
||||||
*
|
*
|
||||||
|
|
@ -491,8 +471,8 @@ unspecified_type default_initial_points_generation();
|
||||||
* parameters::initial_points_generator(CGAL::Construct_initial_points_labeled_image(image)));
|
* parameters::initial_points_generator(CGAL::Construct_initial_points_labeled_image(image)));
|
||||||
* \endcode
|
* \endcode
|
||||||
*
|
*
|
||||||
* \sa `CGAL::parameters::default_initial_points_generation()`
|
|
||||||
* \sa `CGAL::make_mesh_3()`
|
* \sa `CGAL::make_mesh_3()`
|
||||||
|
* \sa `MeshDomain_3::Construct_initial_points`
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
template <typename InitialPointsGenerator>
|
template <typename InitialPointsGenerator>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ a set of initial points on the surface of the domain.
|
||||||
|
|
||||||
\cgalHasModelsBegin
|
\cgalHasModelsBegin
|
||||||
\cgalHasModels{CGAL::Construct_initial_points_labeled_image}
|
\cgalHasModels{CGAL::Construct_initial_points_labeled_image}
|
||||||
|
\cgalHasModels{CGAL::Construct_initial_points_gray_image}
|
||||||
\cgalHasModelsEnd
|
\cgalHasModelsEnd
|
||||||
|
|
||||||
\sa `MeshCellCriteria_3`
|
\sa `MeshCellCriteria_3`
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ INPUT += \
|
||||||
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_in_image.h \
|
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_in_image.h \
|
||||||
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_on_image_bbox.h \
|
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Detect_features_on_image_bbox.h \
|
||||||
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h \
|
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_edge_criteria_3.h \
|
||||||
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_labeled_image.h
|
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_labeled_image.h \
|
||||||
|
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/Construct_initial_points_gray_image.h
|
||||||
|
|
||||||
PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation"
|
PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation"
|
||||||
HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \
|
HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \
|
||||||
|
|
|
||||||
|
|
@ -751,7 +751,7 @@ For the meshing, in the previous example (\ref Mesh_3/mesh_3D_image.cpp), we cal
|
||||||
In the example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp,
|
In the example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp,
|
||||||
that call is replaced by:
|
that call is replaced by:
|
||||||
-# the creation of an empty `%c3t3` object,
|
-# the creation of an empty `%c3t3` object,
|
||||||
-# a call to a non-documented function
|
-# a call to the function
|
||||||
`initialize_triangulation_from_labeled_image()` that inserts points in
|
`initialize_triangulation_from_labeled_image()` that inserts points in
|
||||||
the triangulation,
|
the triangulation,
|
||||||
-# then the call to `refine_mesh_3()`.
|
-# then the call to `refine_mesh_3()`.
|
||||||
|
|
@ -761,9 +761,9 @@ that call is replaced by:
|
||||||
The code of the function `initialize_triangulation_from_labeled_image()` is
|
The code of the function `initialize_triangulation_from_labeled_image()` is
|
||||||
in the header \ref
|
in the header \ref
|
||||||
CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h. It gets points from
|
CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h. It gets points from
|
||||||
\ref CGAL/Mesh_3/Construct_initial_points_labeled_image.h and insert them
|
\ref CGAL/Mesh_3/Construct_initial_points_labeled_image.h and inserts them
|
||||||
in the triangulation. The code of the Construct_initial_points_labeled_image
|
in the triangulation. The code of the `Construct_initial_points_labeled_image`
|
||||||
function is rather complicated. The following lines show how to insert new
|
functor is rather complicated. The following lines show how to insert new
|
||||||
points in the `%c3t3` object, with the calls to
|
points in the `%c3t3` object, with the calls to
|
||||||
`MeshVertexBase_3::set_dimension()` and
|
`MeshVertexBase_3::set_dimension()` and
|
||||||
`MeshVertexBase_3::set_index()`.
|
`MeshVertexBase_3::set_index()`.
|
||||||
|
|
@ -836,7 +836,7 @@ CGAL/Mesh_3/initialize_triangulation_from_gray_image.h.
|
||||||
The example \ref Mesh_3/mesh_3D_image_with_initial_points.cpp is another
|
The example \ref Mesh_3/mesh_3D_image_with_initial_points.cpp is another
|
||||||
way to achieve the same results. Instead of a custom initialization,
|
way to achieve the same results. Instead of a custom initialization,
|
||||||
it uses the parameter `CGAL::parameters::initial_points_generator` for the function
|
it uses the parameter `CGAL::parameters::initial_points_generator` for the function
|
||||||
`CGAL::make_mesh_3`. This parameter expect a functor that ouputs points for
|
`CGAL::make_mesh_3`. This parameter expects a functor that returns a set of points for
|
||||||
the mesh initialization (concept `InitialPointsGenerator`).
|
the mesh initialization (concept `InitialPointsGenerator`).
|
||||||
|
|
||||||
\snippet Mesh_3/mesh_3D_image_with_initial_points.cpp Meshing
|
\snippet Mesh_3/mesh_3D_image_with_initial_points.cpp Meshing
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ The following functors are available for feature detection:
|
||||||
The following functors are available for mesh initialization:
|
The following functors are available for mesh initialization:
|
||||||
|
|
||||||
- `CGAL::Construct_initial_points_labeled_image`
|
- `CGAL::Construct_initial_points_labeled_image`
|
||||||
|
- `CGAL::Construct_initial_points_gray_image`
|
||||||
|
|
||||||
\cgalCRPSection{Function Templates}
|
\cgalCRPSection{Function Templates}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
// Copyright (c) 20XX,20XX GeometryFactory
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of CGAL (www.cgal.org).
|
||||||
|
//
|
||||||
|
// $URL$
|
||||||
|
// $Id$
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Author(s) : Laurent Rineau and Ange Clement
|
||||||
|
|
||||||
|
#ifndef CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H
|
||||||
|
#define CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H
|
||||||
|
|
||||||
|
#include <CGAL/license/Mesh_3.h>
|
||||||
|
|
||||||
|
#include <CGAL/Labeled_mesh_domain_3.h>
|
||||||
|
#include <CGAL/Mesh_3/Construct_initial_points_labeled_image.h>
|
||||||
|
|
||||||
|
#include <CGAL/Image_3.h>
|
||||||
|
|
||||||
|
namespace CGAL
|
||||||
|
{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \ingroup PkgMesh3Initializers
|
||||||
|
*
|
||||||
|
* Functor for initial points generation in gray images.
|
||||||
|
* This functor is a model of concept `InitialPointsGenerator`,
|
||||||
|
* and thus can be passed to `CGAL::make_mesh_3` with the parameter
|
||||||
|
* `CGAL::parameters::initial_points_generator()`
|
||||||
|
*
|
||||||
|
* \sa `CGAL::parameters::initial_points_generator()`
|
||||||
|
* \sa `CGAL::make_mesh_3()`
|
||||||
|
*/
|
||||||
|
template <typename Functor = CGAL::Null_functor>
|
||||||
|
struct Construct_initial_points_gray_image
|
||||||
|
{
|
||||||
|
const CGAL::Image_3 & image_;
|
||||||
|
double iso_value_;
|
||||||
|
Functor image_values_to_subdomain_indices_;
|
||||||
|
|
||||||
|
template <typename FT>
|
||||||
|
Construct_initial_points_gray_image(const CGAL::Image_3 & image,
|
||||||
|
const FT& iso_value,
|
||||||
|
const Functor image_values_to_subdomain_indices = CGAL::Null_functor())
|
||||||
|
: image_(image)
|
||||||
|
, iso_value_(iso_value)
|
||||||
|
, image_values_to_subdomain_indices_(image_values_to_subdomain_indices)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Constructs the initial points using the gray image.
|
||||||
|
*
|
||||||
|
* @tparam OutputIterator an `OutputIterator` of points of type
|
||||||
|
* `std::pair<MeshDomain::Point_3, MeshDomain::Index>`
|
||||||
|
* @tparam MeshDomain a model of `MeshDomain_3`
|
||||||
|
* @tparam C3t3 a model of `MeshComplex_3InTriangulation_3`
|
||||||
|
*/
|
||||||
|
template <typename OutputIterator, typename MeshDomain, typename C3t3>
|
||||||
|
OutputIterator operator()(OutputIterator pts, const MeshDomain& domain, const C3t3& c3t3, int n = 20) const
|
||||||
|
{
|
||||||
|
using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices;
|
||||||
|
typedef Create_gray_image_values_to_subdomain_indices<Functor> C_i_v_t_s_i;
|
||||||
|
typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices;
|
||||||
|
Image_values_to_subdomain_indices transform_fct =
|
||||||
|
C_i_v_t_s_i()(image_values_to_subdomain_indices_, iso_value_);
|
||||||
|
Construct_initial_points_labeled_image(image_).operator()(pts, domain, transform_fct, c3t3, n);
|
||||||
|
return pts;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_MESH_3_CONSTRUCT_INITIAL_POINTS_GRAY_IMAGE_H
|
||||||
|
|
@ -80,6 +80,7 @@ struct Get_point
|
||||||
*
|
*
|
||||||
* \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()`
|
||||||
*/
|
*/
|
||||||
struct Construct_initial_points_labeled_image
|
struct Construct_initial_points_labeled_image
|
||||||
{
|
{
|
||||||
|
|
@ -89,8 +90,8 @@ struct Construct_initial_points_labeled_image
|
||||||
: image(image_)
|
: image(image_)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief operator () The points are constructed using the API of the mesh domain, as follows.
|
* \brief Constructs the points using the API of the mesh domain, as follows.
|
||||||
* First the functor `construct_intersect` is created
|
* First the functor `construct_intersect` is created
|
||||||
*
|
*
|
||||||
* \snippet this construct intersection
|
* \snippet this construct intersection
|
||||||
|
|
@ -112,6 +113,20 @@ struct Construct_initial_points_labeled_image
|
||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Same as above, but a `TransformOperator` is used
|
||||||
|
*
|
||||||
|
* @tparam OutputIterator an `OutputIterator` of points of type
|
||||||
|
* `std::pair<MeshDomain::Point_3, MeshDomain::Index>`
|
||||||
|
* @tparam MeshDomain a model of `MeshDomain_3`
|
||||||
|
* @tparam TransformOperator a functor to transform values of the image.
|
||||||
|
* It must provides the following type:<br>
|
||||||
|
* `result_type`<br>
|
||||||
|
* and the following operator:<br>
|
||||||
|
* `template<typename FT>`<br>
|
||||||
|
* `result_type operator()(FT v)`
|
||||||
|
* @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
|
||||||
{
|
{
|
||||||
|
|
@ -179,10 +194,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);
|
||||||
/// [construct intersection]
|
/// \noop [construct intersection]
|
||||||
typename MeshDomain::Construct_intersection construct_intersection =
|
typename MeshDomain::Construct_intersection construct_intersection =
|
||||||
domain.construct_intersection_object();
|
domain.construct_intersection_object();
|
||||||
/// [construct intersection]
|
/// \noop [construct intersection]
|
||||||
|
|
||||||
std::vector<Vector_3> directions;
|
std::vector<Vector_3> directions;
|
||||||
if(seed.radius < 2) {
|
if(seed.radius < 2) {
|
||||||
|
|
@ -206,16 +221,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);
|
||||||
|
|
||||||
/// [use construct intersection]
|
/// \noop [use construct intersection]
|
||||||
const typename MeshDomain::Intersection intersect =
|
const typename MeshDomain::Intersection intersect =
|
||||||
construct_intersection(test_segment);
|
construct_intersection(test_segment);
|
||||||
/// [use construct intersection]
|
/// \noop [use construct intersection]
|
||||||
if (std::get<2>(intersect) != 0)
|
if (std::get<2>(intersect) != 0)
|
||||||
{
|
{
|
||||||
/// [get construct intersection]
|
/// \noop [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);
|
||||||
/// [get construct intersection]
|
/// \noop [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
|
||||||
|
|
|
||||||
|
|
@ -417,12 +417,12 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false >
|
||||||
* \cgalParamSectionBegin{Mesh initialization}
|
* \cgalParamSectionBegin{Mesh initialization}
|
||||||
* \cgalParamDescription{an `InitialPointsGenerator` can optionally be supplied before the meshing process.
|
* \cgalParamDescription{an `InitialPointsGenerator` can optionally be supplied before the meshing process.
|
||||||
* It must follow the `InitialPointsGenerator` concept.
|
* It must follow the `InitialPointsGenerator` concept.
|
||||||
* The following two named parameters control this option:
|
* The following named parameter control this option:
|
||||||
* <UL>
|
* <UL>
|
||||||
* <LI> `parameters::initial_points_generator()`
|
* <LI> `parameters::initial_points_generator()`
|
||||||
* <LI> `parameters::default_initial_points_generation()`
|
|
||||||
* </UL>}
|
* </UL>}
|
||||||
* \cgalParamDefault{`parameters::default_initial_points_generation()`}
|
* \cgalParamDefault{empty `parameters::initial_points_generator()`, the domain's `construct_initial_points_object()`
|
||||||
|
* will be called for the points initialization.}
|
||||||
* \cgalParamSectionEnd
|
* \cgalParamSectionEnd
|
||||||
* \cgalNamedParamsEnd
|
* \cgalNamedParamsEnd
|
||||||
*
|
*
|
||||||
|
|
@ -462,7 +462,7 @@ C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, const C
|
||||||
|
|
||||||
parameters::internal::Initial_points_generator_options<MeshDomain, C3T3> initial_points_generator_options_param =
|
parameters::internal::Initial_points_generator_options<MeshDomain, C3T3> initial_points_generator_options_param =
|
||||||
parameters::internal::Initial_points_generator_generator<MeshDomain, C3T3>()
|
parameters::internal::Initial_points_generator_generator<MeshDomain, C3T3>()
|
||||||
(choose_parameter(get_parameter(np, internal_np::initial_points_generator_options_param), parameters::default_initial_points_generation().v));
|
(choose_parameter(get_parameter(np, internal_np::initial_points_generator_options_param), parameters::initial_points_generator().v));
|
||||||
|
|
||||||
make_mesh_3_impl(c3t3, domain, criteria,
|
make_mesh_3_impl(c3t3, domain, criteria,
|
||||||
exude_param, perturb_param, odt_param, lloyd_param,
|
exude_param, perturb_param, odt_param, lloyd_param,
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ features(const MeshDomain& /*domain*/)
|
||||||
// Initial_points_generator_options
|
// Initial_points_generator_options
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
inline Named_function_parameters<::CGAL::parameters::internal::Initial_points_generator_options_holder<>, ::CGAL::internal_np::initial_points_generator_options_param_t, CGAL_NP_BASE>
|
inline Named_function_parameters<::CGAL::parameters::internal::Initial_points_generator_options_holder<>, ::CGAL::internal_np::initial_points_generator_options_param_t, CGAL_NP_BASE>
|
||||||
default_initial_points_generation() {
|
initial_points_generator() {
|
||||||
typedef Named_function_parameters<::CGAL::parameters::internal::Initial_points_generator_options_holder<>, ::CGAL::internal_np::initial_points_generator_options_param_t, CGAL_NP_BASE> Param;
|
typedef Named_function_parameters<::CGAL::parameters::internal::Initial_points_generator_options_holder<>, ::CGAL::internal_np::initial_points_generator_options_param_t, CGAL_NP_BASE> Param;
|
||||||
return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Initial_points_generator_options_holder<>());
|
return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Initial_points_generator_options_holder<>());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue