diff --git a/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h index 59808d44899..2ed642b8bb5 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h @@ -110,6 +110,7 @@ Labeled_mesh_domain_3(const A_i&...); /*! \brief Construction from an implicit function +\deprecated This function is deprecated since \cgal 5.5, the overload using `NamedParameters` must be used instead. This static method is a named constructor. It constructs a domain whose bounding surface is described implicitly as the zero level set of a @@ -156,6 +157,7 @@ create_implicit_mesh_domain(A_i&...); /*! \brief Construction from a 3D gray image +\deprecated This function is deprecated since \cgal 5.5, the overload using `NamedParameters` must be used instead. This static method is a named constructor. It constructs a domain described by a 3D gray image. A 3D gray image is a grid of voxels, @@ -215,6 +217,7 @@ create_gray_image_mesh_domain(A_i&...); /*! \brief Construction from a 3D labeled image +\deprecated This function is deprecated since \cgal 5.5, the overload using `NamedParameters` must be used instead. This static method is a named constructor. It constructs a domain described by a 3D labeled image. A 3D labeled image is a grid diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index 0eecbbb80cc..ee7aea455cc 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -12,7 +12,8 @@ INPUT += \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/lloyd_optimize_mesh_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/perturb_mesh_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/refine_mesh_3.h \ - ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/make_mesh_3.h + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/make_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Labeled_mesh_domain_3.h PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Mesh Generation" HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg \ ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_4.jpg \ diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp index 40dddc6a1a9..3ba8acb7336 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp @@ -37,7 +37,7 @@ int main(int argc, char*argv[]) } /// [Domain creation] Mesh_domain domain = - Mesh_domain::create_gray_image_mesh_domain(image, 2.9f, 0.f); + Mesh_domain::create_gray_image_mesh_domain(image, iso_value_new = 2.9f, value_outside_new = 0.f); /// [Domain creation] // Mesh criteria diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp index 86edd7f2e78..8e5f8e69345 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) } /// [Domain creation] Mesh_domain domain = - Mesh_domain::create_gray_image_mesh_domain(image, 2.9f, 0.f); + Mesh_domain::create_gray_image_mesh_domain(image, iso_value_new - 2.9f, value_outside_new = 0.f); /// [Domain creation] /// [Mesh criteria] diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp index f6b072b3dcd..d82201f87f7 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp @@ -45,8 +45,8 @@ int main(int argc, char* argv[]) Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, - weights = img_weights, - relative_error_bound = 1e-6); + weights_new = img_weights, + relative_error_bound_new = 1e-6); /// [Domain creation] // Mesh criteria diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp index 3c1fc5c163d..afddfcd006e 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp @@ -54,8 +54,8 @@ int main() /// [Domain creation] (Warning: Sphere_3 constructor uses squared radius !) namespace p = CGAL::parameters; Mesh_domain domain = Mesh_domain::create_implicit_mesh_domain - (p::function = &sphere_function, - p::bounding_object = K::Sphere_3(CGAL::ORIGIN, 2.) + (sphere_function, + K::Sphere_3(CGAL::ORIGIN, 2.) ); /// [Domain creation] diff --git a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h index 2cc5e2cb59d..fd3210695c5 100644 --- a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h @@ -68,8 +68,8 @@ public: Transform(iso_value), Transform(iso_value)(value_outside)), Mesh_3::internal::compute_bounding_box(image), - error_bound, - p_rng) + parameters::relative_error_bound_new = error_bound, + parameters::p_rng_new = p_rng) { CGAL_assertion(Transform(iso_value)(value_outside) == 0); } @@ -81,8 +81,8 @@ public: CGAL::Random* p_rng = nullptr) : Base(Wrapper(image, transform, transform(value_outside)), Mesh_3::internal::compute_bounding_box(image), - error_bound, - p_rng) + parameters::relative_error_bound_new = error_bound, + parameters::p_rng_new = p_rng) { CGAL_assertion(transform(value_outside) == 0); } diff --git a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h index 3b969f95e8d..4e11f6eb886 100644 --- a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h @@ -65,8 +65,8 @@ public: const Sphere_3& bounding_sphere, const FT& error_bound = FT(1e-6), CGAL::Random* p_rng = nullptr) - : Base(Wrapper(f), bounding_sphere, error_bound, - Null_subdomain_index(), p_rng) {} + : Base(Wrapper(f), bounding_sphere, parameters::relative_error_bound_new = error_bound, + parameters::null_subdomain_index_new = Null_subdomain_index(), parameters::p_rng_new = p_rng) {} /// Destructor virtual ~Implicit_mesh_domain_3() {} diff --git a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h index 31ffaee34c8..ea7c79383b1 100644 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h @@ -77,7 +77,7 @@ public: CGAL::Random* p_rng = nullptr) : Base(Wrapper(image, Identity(), value_outside), compute_bounding_box(image), - error_bound, + parameters::relative_error_bound_new = error_bound, parameters::null_subdomain_index = null, parameters::p_rng = p_rng) {} @@ -87,8 +87,8 @@ public: CGAL::Random* p_rng) : Base(Wrapper(image), compute_bounding_box(image), - error_bound, - p_rng) + parameters::relative_error_bound_new = error_bound, + parameters::p_rng_new = p_rng) {} /// Destructor diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index c093cc52119..2ad605d9905 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -43,7 +43,7 @@ // support for implicit functions #include - +#include #include #include #include @@ -310,24 +310,24 @@ public: typedef typename BGT::FT FT; typedef BGT Geom_traits; - - - BOOST_PARAMETER_CONSTRUCTOR(Labeled_mesh_domain_3, - (Impl_details), - parameters::tag, - (required - (function_,(Function)) - (bounding_object_,*) - ) - (optional - (relative_error_bound_, (const FT&)) - (p_rng_, (CGAL::Random*)) - (null_subdomain_index_,(Null)) - (construct_surface_patch_index_, - (Construct_surface_patch_index)) - ) - ) using Impl_details::construct_pair_functor; + + template + Labeled_mesh_domain_3(const Func& f, const BoundingBox& bbox, const CGAL_NP_CLASS& np = parameters::default_values()) + :Impl_details(f,bbox, + parameters::choose_parameter(parameters::get_parameter(np, internal_np::error_bound), FT(1e-3)), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::surface_patch_index), construct_pair_functor()), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::null_subdomain_index_param), Null_subdomain_index()), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::rng), nullptr)) + { + } +#ifndef CGAL_NO_DEPRECATED_CODE + template + Labeled_mesh_domain_3(const Func& f, const BoundingBox& bbox, const NP_PACK& ...nps):Labeled_mesh_domain_3(f, bbox, internal_np::combine_named_parameters(nps...)) + { + } +#endif //CGAL_NO_DEPRECATED_CODE + /** * Backward-compatibility constructors, with `null_subdomain_index` as * fourth parameter. @@ -368,144 +368,281 @@ public: /// Named constructors /// @{ -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable: 4003) -#endif + /*! + \brief Construction from a 3D gray image - // see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS + This static method is a named constructor. It constructs a domain + described by a 3D gray image. A 3D gray image is a grid of voxels, + where each voxel is associated with a gray level value. Unless otherwise specified by the parameter `image_values_to_subdom_indices`, the domain to + be discretized is the union of voxels that lie inside a surface + described by an isolevel value, called \a isovalue. The voxels lying + inside the domain have gray level values that are larger than the + isovalue. + + The value of voxels is interpolated to a gray level value at any query point. + + This constructor uses named parameters . They can be specified in any order. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param image the input 3D image. Must be a `CGAL::Image_3` object. + + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + + \cgalNamedParamsBegin + \cgalParamNBegin{iso_value} + \cgalParamDescription{the isovalue, inside + `image`, of the surface describing the boundary of the object to be + meshed.} + \cgalParamDefault{0} + + \cgalParamNBegin{image_values_to_subdomain_indices} + \cgalParamDescription{a function or + a function object, compatible with the signature + `Subdomain_index(double)`. This function returns the subdomain index + corresponding to a pixel value. If this parameter is used, then the + parameter `iso_value` is ignored..} + \cgalParamDefault{Null_functor()} + + \cgalParamNBegin{value_outside} + \cgalParamDescription{the value attached to voxels + outside of the domain to be meshed. It should be lower than + `iso_value`.} + \cgalParamDefault{0} + + \cgalParamNBegin{relative_error_bound} + \cgalParamDescription{ is the relative error + bound, relative to the diameter of the box of the image.} + \cgalParamDefault{FT(1e-3)} - BOOST_PARAMETER_MEMBER_FUNCTION( - (Labeled_mesh_domain_3), - static create_gray_image_mesh_domain, - parameters::tag, - (required - (image_, (const CGAL::Image_3&)) - ) - (optional - (iso_value_, *, 0) - (value_outside_, *, 0) - (relative_error_bound_, (const FT&), - FT(1e-3)) - (p_rng_, (CGAL::Random*), (CGAL::Random*)(0)) - (image_values_to_subdomain_indices_, *, - Null_functor()) - (null_subdomain_index_,*,Null_functor()) - (construct_surface_patch_index_, *, - Null_functor()) - ) - ) + \cgalNamedParamsEnd + + \cgalHeading{Examples} + + From the example (\ref Mesh_3/mesh_3D_gray_image.cpp), where the name + of the parameters is not specified, as they are given is the same + order as the parameters definition: + + \snippet Mesh_3/mesh_3D_gray_image.cpp Domain creation + + From the example (\ref Mesh_3/mesh_3D_gray_vtk_image.cpp): + + \snippet Mesh_3/mesh_3D_gray_vtk_image.cpp Domain creation + + */ + template + static Labeled_mesh_domain_3 create_gray_image_mesh_domain(const CGAL::Image_3& image_, const CGAL_NP_CLASS& np = parameters::default_values()) { + using parameters::get_parameter; + using parameters::choose_parameter; + auto iso_value_ = choose_parameter(get_parameter(np, internal_np::iso_value_param), 0); + auto value_outside_ = choose_parameter(get_parameter(np, internal_np::voxel_value), 0); + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + auto image_values_to_subdomain_indices_ = choose_parameter(get_parameter(np, internal_np::image_subdomain_index), Null_functor()); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), (CGAL::Random*)(0)); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); namespace p = CGAL::parameters; return Labeled_mesh_domain_3 - (create_gray_image_wrapper - (image_, - iso_value_, - image_values_to_subdomain_indices_, - value_outside_), - Mesh_3::internal::compute_bounding_box(image_), - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); - } + (create_gray_image_wrapper + (image_, + iso_value_, + image_values_to_subdomain_indices_, + value_outside_), + Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound_new = relative_error_bound_, + p::p_rng_new = p_rng_, + p::null_subdomain_index_new = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index_new = + create_construct_surface_patch_index(construct_surface_patch_index_)); - BOOST_PARAMETER_MEMBER_FUNCTION( - (Labeled_mesh_domain_3), - static create_labeled_image_mesh_domain, - parameters::tag, - (required - (image_, (const CGAL::Image_3&)) - ) - (optional - (relative_error_bound_, (const FT&), - FT(1e-3)) - (weights_, (const CGAL::Image_3&), CGAL::Image_3()) - (value_outside_, *, 0) - (p_rng_, (CGAL::Random*), (CGAL::Random*)(0)) - (image_values_to_subdomain_indices_, *, - Null_functor()) - (null_subdomain_index_,*,Null_functor()) - (construct_surface_patch_index_, *, - Null_functor()) - ) - ) + } +#ifndef CGAL_NO_DEPRECATED_CODE + template + static Labeled_mesh_domain_3 create_gray_image_mesh_domain(const CGAL::Image_3& image_, const NP_Pack& ...nps) + { + return create_gray_image_mesh_domain(image_, internal_np::combine_named_parameters(nps...)); + } +#endif //CGAL_NO_DEPRECATED_CODE + + + /*! + * \brief Construction from a 3D labeled image + + This static method is a named constructor. It constructs a + domain described by a 3D labeled image. A 3D labeled image is a grid + of voxels, where each voxel is associated with an index (a subdomain + index) characterizing the subdomain in which the voxel lies. The + domain to be discretized is the union of voxels that have non-zero + values. + + This constructor uses named parameters . They can be specified in any order. + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param image the input 3D image. Must be a `CGAL::Image_3` object. + + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + + \cgalNamedParamsBegin + \cgalParamNBegin{weights} + \cgalParamDescription{an input 3D image that provides + weights associated to each voxel (the word type is `unsigned char`, + and the voxels values are integers between 0 and 255). + The weights image can be generated with `CGAL::Mesh_3::generate_label_weights()`. + Its dimensions must be the same as the dimensions of `parameters::image`.} + \cgalParamDefault{CGAL::Image_3()} + + \cgalParamNBegin{value_outside} + \cgalParamDescription{the value attached to voxels + outside of the domain to be meshed. It should be lower than + `iso_value`.} + \cgalParamDefault{0} + + \cgalParamNBegin{relative_error_bound} + \cgalParamDescription{ is the relative error + bound, relative to the diameter of the box of the image.} + \cgalParamDefault{FT(1e-3)} + \cgalNamedParamsEnd + +\cgalHeading{Example} + +From the example (\ref Mesh_3/mesh_3D_image.cpp): + +\snippet Mesh_3/mesh_3D_image.cpp Domain creation + +From the example (\ref Mesh_3/mesh_3D_weighted_image.cpp), +where the labeled image is used with a precomputed 3D image of weights : + +\snippet Mesh_3/mesh_3D_weighted_image.cpp Domain creation + + */ + template + static Labeled_mesh_domain_3 create_labeled_image_mesh_domain(const CGAL::Image_3& image_, const CGAL_NP_CLASS& np = parameters::default_values()) + { + using parameters::get_parameter; + using parameters::choose_parameter; + auto iso_value_ = choose_parameter(get_parameter(np, internal_np::iso_value_param), FT(0)); + auto value_outside_ = choose_parameter(get_parameter(np, internal_np::voxel_value), FT(0)); + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + auto image_values_to_subdomain_indices_ = choose_parameter(get_parameter(np, internal_np::image_subdomain_index), Null_functor()); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), (CGAL::Random*)(0)); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); + CGAL::Image_3 weights_ = choose_parameter(get_parameter(np, internal_np::weights_param), CGAL::Image_3()); + + namespace p = CGAL::parameters; + if (weights_.is_valid()) + { + return Labeled_mesh_domain_3 + (create_weighted_labeled_image_wrapper + (image_, + weights_, + image_values_to_subdomain_indices_, + value_outside_), + Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound_new = relative_error_bound_, + p::p_rng_new = p_rng_, + p::null_subdomain_index_new = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index_new = + create_construct_surface_patch_index(construct_surface_patch_index_)); + } + else + { + return Labeled_mesh_domain_3 + (create_labeled_image_wrapper + (image_, + image_values_to_subdomain_indices_, + value_outside_), + Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound_new = relative_error_bound_, + p::p_rng_new = p_rng_, + p::null_subdomain_index_new = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index_new = + create_construct_surface_patch_index(construct_surface_patch_index_)); + } + } +#ifndef CGAL_NO_DEPRECATED_CODE + template + static Labeled_mesh_domain_3 create_labeled_image_mesh_domain(const CGAL::Image_3& image_, const NP_Pack& ...nps) + { + return create_labeled_image_mesh_domain(image_, internal_np::combine_named_parameters(nps...)); + } +#endif //CGAL_NO_DEPRECATED_CODE + + + +/// \name Creation of domains from implicit functions + +/*! +\brief Construction from an implicit function + +This static method is a named constructor. It constructs a domain +whose bounding surface is described implicitly as the zero level set of a +function. The domain to be discretized is assumed to be the domain where +the function has negative values. + +The method takes as argument a bounding sphere which is required to +circumscribe the surface and to have its center inside the domain. + +This constructor uses named parameters (from the Boost Parameter +Library). They can be specified in any order. + + \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + + \param function the implicit function, compatible with the signature `FT(Point_3)`: it takes a point as argument, + and returns a scalar value. That object must be model of `CopyConstructible`. + \param bounding_object the bounding object is either a bounding sphere (of type `Sphere_3`), a bounding box (type + `Bbox_3`), or a bounding `Iso_cuboid_3`. It must bounds the surface, and + its center must be inside the domain. + + \param np an optional sequence of \ref bgl_namedparameters "Named Parameters". + +\cgalHeading{Examples} + +From the example (\ref Mesh_3/mesh_implicit_sphere.cpp), where the name of +the parameters is not specified, as they are given is the same order as the +parameters definition: + +\snippet Mesh_3/mesh_implicit_sphere.cpp Domain creation + +From the example (\ref Mesh_3/mesh_implicit_sphere_variable_size.cpp): + +\snippet Mesh_3/mesh_implicit_sphere_variable_size.cpp Domain creation + + */ + + template + static Labeled_mesh_domain_3 create_implicit_mesh_domain(Function function_, BoundingObject bounding_object_, const CGAL_NP_CLASS& np = parameters::default_values()) { - namespace p = CGAL::parameters; - if (weights_.is_valid()) - { + using parameters::get_parameter; + using parameters::choose_parameter; + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), (CGAL::Random*)(0)); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); + namespace p = CGAL::parameters; return Labeled_mesh_domain_3 - (create_weighted_labeled_image_wrapper - (image_, - weights_, - image_values_to_subdomain_indices_, - value_outside_), - Mesh_3::internal::compute_bounding_box(image_), - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); - } - else - { - return Labeled_mesh_domain_3 - (create_labeled_image_wrapper - (image_, - image_values_to_subdomain_indices_, - value_outside_), - Mesh_3::internal::compute_bounding_box(image_), - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); - } + (make_implicit_to_labeling_function_wrapper(function_), + bounding_object_, + p::relative_error_bound_new = relative_error_bound_, + p::p_rng_new = p_rng_, + p::null_subdomain_index_new = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index_new = + create_construct_surface_patch_index(construct_surface_patch_index_)); } - BOOST_PARAMETER_MEMBER_FUNCTION( - (Labeled_mesh_domain_3), - static create_implicit_mesh_domain, - parameters::tag, - (required - (function_, *) - (bounding_object_,*) - ) - (optional - (relative_error_bound_, (const FT&), - FT(1e-3)) - (p_rng_, (CGAL::Random*), (CGAL::Random*)(0)) - (null_subdomain_index_,*,Null_functor()) - (construct_surface_patch_index_, *, - Null_functor()) - ) - ) +#ifndef CGAL_NO_DEPRECATED_CODE + template + static Labeled_mesh_domain_3 create_implicit_mesh_domain(Function function_, BoundingObject bounding_object_, const NP_Pack& ...nps) { - namespace p = CGAL::parameters; - return Labeled_mesh_domain_3 - (make_implicit_to_labeling_function_wrapper(function_), - bounding_object_, - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); + return create_implicit_mesh_domain(function_, bounding_object_, internal_np::combine_named_parameters(nps...)); } +#endif //CGAL_NO_DEPRECATED_CODE -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif /// @} /** diff --git a/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp b/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp index 67047b119a8..f7a9ba7cba8 100644 --- a/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp +++ b/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp @@ -68,7 +68,7 @@ int main() v.push_back(f1); v.push_back(f2); // Domain (Warning: Sphere_3 constructor uses square radius !) - Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); + Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), relative_error_bound_new = 1e-6); // Set mesh criteria Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation diff --git a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp index 0c3a1b8c7bb..d4b8802ee13 100644 --- a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp +++ b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp @@ -72,12 +72,12 @@ private: Function f_sphere(&sphere_function); Function_wrapper wrapper_1(f_sphere); - Mesh_domain domain(wrapper_1, bounding_shape, error_bound); + Mesh_domain domain(wrapper_1, bounding_shape, CGAL::parameters::relative_error_bound_new = error_bound); test_construct_initial_points(domain, error_bound); Function f_shape(&shape_function); Function_wrapper wrapper_2(f_shape); - Mesh_domain domain_2(wrapper_2, bounding_shape, error_bound); + Mesh_domain domain_2(wrapper_2, bounding_shape, CGAL::parameters::relative_error_bound_new = error_bound); test_is_in_domain(domain_2); test_do_intersect_surface(domain_2); test_construct_intersection(domain_2); diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp index bbb5951b56c..95e516f5da8 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_3D_gray_image.cpp @@ -67,10 +67,10 @@ public: // Domain Mesh_domain domain = Mesh_domain::create_gray_image_mesh_domain(image, - p::iso_value = 2.9f, - p::value_outside = 0.f, - p::relative_error_bound = 1e-3, - p::p_rng = + p::iso_value_new = 2.9f, + p::value_outside_new = 0.f, + p::relative_error_bound_new = 1e-3, + p::p_rng_new = &CGAL::get_default_random()); // Mesh criteria diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp index 5edfe1648a6..a08fc1acbc0 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp @@ -48,8 +48,8 @@ public: << CGAL::get_default_random().get_seed() << std::endl; Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain (image, - 1e-9, - CGAL::parameters::p_rng = &CGAL::get_default_random()); + CGAL::parameters::relative_error_bound_new = 1e-9, + CGAL::parameters::p_rng_new = &CGAL::get_default_random()); // Set mesh criteria Facet_criteria facet_criteria(25, 20*image.vx(), 5*image.vx()); diff --git a/Mesh_3/test/Mesh_3/test_meshing_implicit_function.cpp b/Mesh_3/test/Mesh_3/test_meshing_implicit_function.cpp index c2a0fe8f0fe..64f9490a957 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_implicit_function.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_implicit_function.cpp @@ -43,10 +43,10 @@ struct Implicit_tester : public Tester namespace p = CGAL::parameters; Mesh_domain domain = Mesh_domain::create_implicit_mesh_domain - (p::function = Implicit_tester::sphere_function, - p::bounding_object = Sphere_3(CGAL::ORIGIN,2.), - p::p_rng = &CGAL::get_default_random(), - p::relative_error_bound = 1e-3); + (Implicit_tester::sphere_function, + Sphere_3(CGAL::ORIGIN,2.), + p::p_rng_new = &CGAL::get_default_random(), + p::relative_error_bound_new = 1e-3); // Set mesh criteria Facet_criteria facet_criteria(0, 0, 0.3); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index 4ef6a35b7a1..f79b0e70341 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -288,8 +288,8 @@ SMesh* cgal_off_meshing(QWidget*, Mesh_domain::create_implicit_mesh_domain (offset_function(tm_ptr, offset_value), Sphere_3(center, sqrad), - p::relative_error_bound = 1e-7, - p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); }); + p::relative_error_bound_new = 1e-7, + p::construct_surface_patch_index_new = [](int i, int j) { return (i * 1000 + j); }); const CGAL::Mesh_facet_topology topology = CGAL::FACET_VERTICES_ON_SAME_SURFACE_PATCH; auto manifold_option = p::non_manifold(); diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index b0ab6d00de5..743574ff08f 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -367,6 +367,18 @@ const Boost_parameter_compatibility_wrapper const Boost_parameter_compatibility_wrapper mesh_options_param_new; const Boost_parameter_compatibility_wrapper manifold_options_param_new; const Boost_parameter_compatibility_wrapper features_param_new; + +const Boost_parameter_compatibility_wrapper image_new; +const Boost_parameter_compatibility_wrapper iso_value_new; +const Boost_parameter_compatibility_wrapper image_values_to_subdomain_indices_new; +const Boost_parameter_compatibility_wrapper value_outside_new; +const Boost_parameter_compatibility_wrapper relative_error_bound_new; +const Boost_parameter_compatibility_wrapper p_rng_new; +const Boost_parameter_compatibility_wrapper null_subdomain_index_new; +const Boost_parameter_compatibility_wrapper construct_surface_patch_index_new; +const Boost_parameter_compatibility_wrapper weights_new; + + #endif // function to extract a parameter diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index c45593c5aab..8e003417825 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -277,4 +277,14 @@ CGAL_add_named_parameter(lloyd_options_param_t, lloyd_options_param, lloyd_optio CGAL_add_named_parameter(reset_options_param_t, reset_options_param, reset_options_param) CGAL_add_named_parameter(mesh_param_t, mesh_param, mesh_param) CGAL_add_named_parameter(manifold_param_t, manifold_param, manifold_param) -CGAL_add_named_parameter(features_option_param_t,features_options_param,features_options_param) \ No newline at end of file +CGAL_add_named_parameter(features_option_param_t,features_options_param,features_options_param) + +CGAL_add_named_parameter(image_3_param_t, image_3_param, image_3_param) +CGAL_add_named_parameter(iso_value_param_t, iso_value_param, iso_value_param) +CGAL_add_named_parameter(image_subdomain_index_t, image_subdomain_index, image_subdomain_index) +CGAL_add_named_parameter(voxel_value_t, voxel_value, voxel_value) +CGAL_add_named_parameter(error_bound_t, error_bound, error_bound) +CGAL_add_named_parameter(rng_t, rng, rng) +CGAL_add_named_parameter(null_subdomain_index_param_t,null_subdomain_index_param, null_subdomain_index_param) +CGAL_add_named_parameter(surface_patch_index_t, surface_patch_index, surface_patch_index) +CGAL_add_named_parameter(weights_param_t, weights_param, weights_param) diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp index 2b6164634de..eb74c9b3fdb 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp @@ -39,7 +39,7 @@ int main() std::cerr << "Error: Cannot read file " << filename << std::endl; return EXIT_FAILURE; } - Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, 1e-9); + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, relative_error_bound_new = 1e-9); // Mesh criteria Facet_criteria facet_criteria(25, 20, 2); // angle, size, approximation