mirror of https://github.com/CGAL/cgal
WIP: Change the template parameters of Labeled_image_mesh_domain_3 (TODO)
TODO: document the changes, once that is over.
This commit is contained in:
parent
cbcad49920
commit
7e9165d78a
|
|
@ -29,7 +29,7 @@ typedef FT (*Function)(const Point&);
|
|||
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
|
||||
Function_wrapper;
|
||||
typedef Function_wrapper::Function_vector Function_vector;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, K> Mesh_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
|
||||
|
||||
// Triangulation
|
||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ typedef FT (*Function)(const Point&);
|
|||
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
|
||||
Function_wrapper;
|
||||
typedef Function_wrapper::Function_vector Function_vector;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, K> Mesh_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
|
||||
typedef CGAL::Mesh_domain_with_polyline_features_3<Mesh_domain> Mesh_domain_with_features;
|
||||
|
||||
// Triangulation
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ typedef FT_to_point_function_wrapper<K::FT, K::Point_3> Function;
|
|||
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
|
||||
Function_wrapper;
|
||||
typedef Function_wrapper::Function_vector Function_vector;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, K> Mesh_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
|
||||
|
||||
// Triangulation
|
||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
||||
|
|
@ -43,7 +43,7 @@ int main()
|
|||
v.push_back(f2);
|
||||
|
||||
// Domain (Warning: Sphere_3 constructor uses square radius !)
|
||||
Mesh_domain domain(v, K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6);
|
||||
Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6);
|
||||
|
||||
// Set mesh criteria
|
||||
Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ typedef FT_to_point_function_wrapper<K::FT, K::Point_3> Function;
|
|||
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
|
||||
Function_wrapper;
|
||||
typedef Function_wrapper::Function_vector Function_vector;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, K> Mesh_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
|
||||
|
||||
// Triangulation
|
||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
||||
|
|
|
|||
|
|
@ -61,13 +61,7 @@ template<class Image,
|
|||
typename Transform = internal::Greater_than<double>,
|
||||
typename Subdomain_index = int>
|
||||
class Gray_image_mesh_domain_3
|
||||
: public Labeled_mesh_domain_3<
|
||||
Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
|
||||
Image_word_type_,
|
||||
Subdomain_index,
|
||||
Transform,
|
||||
false> ,
|
||||
BGT>
|
||||
: public Labeled_mesh_domain_3<BGT, Subdomain_index>
|
||||
{
|
||||
public:
|
||||
typedef Image_word_type_ Image_word_type;
|
||||
|
|
@ -77,7 +71,7 @@ public:
|
|||
Transform,
|
||||
false> Wrapper;
|
||||
|
||||
typedef Labeled_mesh_domain_3<Wrapper, BGT> Base;
|
||||
typedef Labeled_mesh_domain_3<BGT, Subdomain_index> Base;
|
||||
|
||||
typedef typename Base::Sphere_3 Sphere_3;
|
||||
typedef typename Base::FT FT;
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ template<class Function,
|
|||
class BGT,
|
||||
class Wrapper = Implicit_to_labeling_function_wrapper<Function,BGT> >
|
||||
class Implicit_mesh_domain_3
|
||||
: public Labeled_mesh_domain_3<Wrapper, BGT >
|
||||
: public Labeled_mesh_domain_3<BGT>
|
||||
{
|
||||
public:
|
||||
/// Base type
|
||||
typedef Labeled_mesh_domain_3<Wrapper, BGT> Base;
|
||||
typedef Labeled_mesh_domain_3<BGT> Base;
|
||||
|
||||
/// Public types
|
||||
typedef typename Base::Sphere_3 Sphere_3;
|
||||
|
|
|
|||
|
|
@ -52,16 +52,7 @@ template<class Image,
|
|||
class Null_subdomain_index = Default,
|
||||
class Wrapper_ = Default >
|
||||
class Labeled_image_mesh_domain_3
|
||||
: public Labeled_mesh_domain_3
|
||||
<typename Default::Get
|
||||
<Wrapper_,
|
||||
Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
|
||||
Image_word_type_,
|
||||
Subdomain_index>
|
||||
>::type,
|
||||
BGT,
|
||||
Null_subdomain_index
|
||||
>
|
||||
: public Labeled_mesh_domain_3<BGT, Subdomain_index>
|
||||
{
|
||||
public:
|
||||
typedef Image_word_type_ Image_word_type;
|
||||
|
|
@ -74,7 +65,7 @@ public:
|
|||
typedef typename Default::Get<Null_subdomain_index,
|
||||
CGAL::Null_subdomain_index>::type Null;
|
||||
|
||||
typedef Labeled_mesh_domain_3<Wrapper, BGT, Null_subdomain_index> Base;
|
||||
typedef Labeled_mesh_domain_3<BGT, Subdomain_index> Base;
|
||||
|
||||
typedef typename Base::Sphere_3 Sphere_3;
|
||||
typedef typename Base::FT FT;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include <CGAL/function.h>
|
||||
|
||||
#include <CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h>
|
||||
#include <CGAL/internal/Mesh_3/indices_management.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -66,9 +67,11 @@ struct Construct_pair_from_subdomain_indices {
|
|||
}; // end class template Construct_pair_from_subdomain_indices
|
||||
|
||||
template <typename Geom_traits,
|
||||
typename Subdomain_index>
|
||||
typename Subdomain_index,
|
||||
typename Surface_patch_index_>
|
||||
class Labeled_mesh_domain_3_impl_details {
|
||||
protected:
|
||||
typedef Surface_patch_index_ Surface_patch_index;
|
||||
typedef typename Geom_traits::Point_3 Point_3;
|
||||
typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid_3;
|
||||
typedef typename Geom_traits::FT FT;
|
||||
|
|
@ -101,12 +104,16 @@ protected:
|
|||
}
|
||||
|
||||
/// The function which answers subdomain queries
|
||||
CGAL::cpp11::function<Subdomain_index(const Point_3&)> function_;
|
||||
typedef CGAL::cpp11::function<Subdomain_index(const Point_3&)> Function;
|
||||
Function function_;
|
||||
/// The bounding box
|
||||
const Iso_cuboid_3 bbox_;
|
||||
CGAL::cpp11::function<Surface_patch_index(Subdomain_index,
|
||||
Subdomain_index)> cstr_s_p_index;
|
||||
/// The functor that decides which sub-domain indices correspond to the
|
||||
/// outside of the domain.
|
||||
CGAL::cpp11::function<bool(Subdomain_index)> null;
|
||||
typedef CGAL::cpp11::function<bool(Subdomain_index)> Null;
|
||||
Null null;
|
||||
/// The random number generator used by Construct_initial_points
|
||||
CGAL::Random* p_rng_;
|
||||
bool delete_rng_;
|
||||
|
|
@ -126,17 +133,49 @@ protected:
|
|||
* tags of it's incident subdomain.
|
||||
* Thus, a boundary facet of the domain is labelled <0,b>, where b!=0.
|
||||
*/
|
||||
template<class Function, class BGT,
|
||||
class Null_subdomain_index = Default,
|
||||
class Construct_surface_patch_index = Default>
|
||||
class Labeled_mesh_domain_3
|
||||
: protected Labeled_mesh_domain_3_impl_details<BGT,
|
||||
typename Function::return_type>
|
||||
template<class BGT,
|
||||
class Subdomain_index_ = int,
|
||||
class Surface_patch_index_ = Default>
|
||||
class Labeled_mesh_domain_3 :
|
||||
protected Labeled_mesh_domain_3_impl_details
|
||||
<
|
||||
BGT,
|
||||
Subdomain_index_,
|
||||
typename Default::Get< Surface_patch_index_,
|
||||
std::pair<Subdomain_index_,
|
||||
Subdomain_index_>
|
||||
>::type
|
||||
>
|
||||
|
||||
{
|
||||
public:
|
||||
//-------------------------------------------------------
|
||||
// Index Types
|
||||
//-------------------------------------------------------
|
||||
/// Type of indexes for cells of the input complex
|
||||
typedef Subdomain_index_ Subdomain_index;
|
||||
typedef boost::optional<Subdomain_index> Subdomain;
|
||||
|
||||
/// Type of indexes for cells of the input complex
|
||||
typedef typename Default::Get< Surface_patch_index_,
|
||||
std::pair<Subdomain_index,
|
||||
Subdomain_index>
|
||||
>::type Surface_patch_index;
|
||||
typedef boost::optional<Surface_patch_index> Surface_patch;
|
||||
|
||||
/// Type of indexes to characterize the lowest dimensional face of the input
|
||||
/// complex on which a vertex lie
|
||||
typedef typename CGAL::internal::Mesh_3::
|
||||
Index_generator<Subdomain_index, Surface_patch_index>::Index Index;
|
||||
|
||||
private:
|
||||
typedef Labeled_mesh_domain_3_impl_details<BGT,
|
||||
typename Function::return_type> Impl_details;
|
||||
typedef typename Default::Get<Null_subdomain_index,
|
||||
CGAL::Null_subdomain_index>::type Null;
|
||||
Subdomain_index,
|
||||
Surface_patch_index
|
||||
> Impl_details;
|
||||
typedef typename Impl_details::Null Null;
|
||||
typedef typename Impl_details::Function Function;
|
||||
|
||||
public:
|
||||
/// Geometric object types
|
||||
typedef typename BGT::Point_3 Point_3;
|
||||
|
|
@ -156,27 +195,6 @@ public:
|
|||
// access Function type from inherited class
|
||||
typedef Function Fct;
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Index Types
|
||||
//-------------------------------------------------------
|
||||
/// Type of indexes for cells of the input complex
|
||||
typedef typename Function::return_type Subdomain_index;
|
||||
typedef boost::optional<Subdomain_index> Subdomain;
|
||||
|
||||
typedef typename Default::Get<Construct_surface_patch_index,
|
||||
Construct_pair_from_subdomain_indices<Subdomain_index>
|
||||
>::type Cstr_surface_patch_index;
|
||||
|
||||
/// Type of indexes for surface patch of the input complex
|
||||
typedef typename CGAL::cpp11::result_of
|
||||
<
|
||||
Cstr_surface_patch_index(Subdomain_index)
|
||||
>::type Surface_patch_index;
|
||||
typedef boost::optional<Surface_patch_index> Surface_patch;
|
||||
/// Type of indexes to characterize the lowest dimensional face of the input
|
||||
/// complex on which a vertex lie
|
||||
typedef typename CGAL::internal::Mesh_3::
|
||||
Index_generator<Subdomain_index, Surface_patch_index>::Index Index;
|
||||
typedef CGAL::cpp11::tuple<Point_3,Index,int> Intersection;
|
||||
|
||||
|
||||
|
|
@ -189,7 +207,7 @@ public:
|
|||
Labeled_mesh_domain_3(const Function& f,
|
||||
const Sphere_3& bounding_sphere,
|
||||
const FT& error_bound = FT(1e-3),
|
||||
Null null = Null(),
|
||||
Null null = Null_subdomain_index(),
|
||||
CGAL::Random* p_rng = NULL)
|
||||
: Impl_details(f, iso_cuboid(bounding_sphere.bbox()),
|
||||
error_bound, null, p_rng) {}
|
||||
|
|
@ -197,14 +215,15 @@ public:
|
|||
Labeled_mesh_domain_3(const Function& f,
|
||||
const Bbox_3& bbox,
|
||||
const FT& error_bound = FT(1e-3),
|
||||
Null null = Null(),
|
||||
Null null = Null_subdomain_index(),
|
||||
CGAL::Random* p_rng = NULL)
|
||||
: Impl_details(f, iso_cuboid(bbox), error_bound, null, p_rng) {}
|
||||
: Impl_details(f, iso_cuboid(bbox),
|
||||
error_bound, null, p_rng) {}
|
||||
|
||||
Labeled_mesh_domain_3(const Function& f,
|
||||
const Iso_cuboid_3& bbox,
|
||||
const FT& error_bound = FT(1e-3),
|
||||
Null null = Null(),
|
||||
Null null = Null_subdomain_index(),
|
||||
CGAL::Random* p_rng = NULL)
|
||||
: Impl_details(f, bbox, error_bound, null, p_rng) {}
|
||||
|
||||
|
|
@ -213,20 +232,21 @@ public:
|
|||
const FT& error_bound,
|
||||
CGAL::Random* p_rng)
|
||||
: Impl_details(f, iso_cuboid(bounding_sphere.bbox()),
|
||||
error_bound, Null(), p_rng) {}
|
||||
error_bound, Null_subdomain_index(), p_rng) {}
|
||||
|
||||
|
||||
Labeled_mesh_domain_3(const Function& f,
|
||||
const Bbox_3& bbox,
|
||||
const FT& error_bound,
|
||||
CGAL::Random* p_rng)
|
||||
: Impl_details(f, iso_cuboid(bbox), error_bound, Null(), p_rng) {}
|
||||
: Impl_details(f, iso_cuboid(bbox),
|
||||
error_bound, Null_subdomain_index(), p_rng) {}
|
||||
|
||||
Labeled_mesh_domain_3(const Function& f,
|
||||
const Iso_cuboid_3& bbox,
|
||||
const FT& error_bound,
|
||||
CGAL::Random* p_rng)
|
||||
: Impl_details(f, bbox, error_bound, Null(), p_rng) {}
|
||||
: Impl_details(f, bbox, error_bound, Null_subdomain_index(), p_rng) {}
|
||||
|
||||
/**
|
||||
* Constructs a set of \ccc{n} points on the surface, and output them to
|
||||
|
|
@ -595,10 +615,10 @@ private:
|
|||
//-------------------------------------------------------
|
||||
// Method implementation
|
||||
//-------------------------------------------------------
|
||||
template<class F, class BGT, class N, class Cstr_s_patch_index>
|
||||
template<class BGT, class Subdomain_index, class Surface_patch_index>
|
||||
template<class OutputIterator>
|
||||
OutputIterator
|
||||
Labeled_mesh_domain_3<F,BGT,N,Cstr_s_patch_index>::
|
||||
Labeled_mesh_domain_3<BGT, Subdomain_index, Surface_patch_index>::
|
||||
Construct_initial_points::operator()(OutputIterator pts,
|
||||
const int nb_points) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ typedef FT_to_point_function_wrapper<K::FT, K::Point_3> Function;
|
|||
typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper<Function>
|
||||
Function_wrapper;
|
||||
typedef Function_wrapper::Function_vector Function_vector;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, K> Mesh_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
|
||||
|
||||
// Triangulation
|
||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
||||
|
|
@ -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(v, K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6);
|
||||
Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6);
|
||||
|
||||
// Set mesh criteria
|
||||
Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ struct LM3_tester
|
|||
};
|
||||
|
||||
typedef CGAL::Implicit_to_labeling_function_wrapper<Function, K> Function_wrapper;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, K> Mesh_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
|
||||
|
||||
static FT shape_function (const Point_3& p)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ typedef CGAL::Mesh_domain_with_polyline_features_3<Image_domain> Image_mesh_doma
|
|||
#endif
|
||||
#ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS
|
||||
typedef Wrapper<Kernel> Function_wrapper;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Function_wrapper, Kernel> Function_domain;
|
||||
typedef CGAL::Labeled_mesh_domain_3<Kernel> Function_domain;
|
||||
typedef CGAL::Polyhedron_demo_labeled_mesh_domain_3<Function_domain> Function_mesh_domain;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue