From 62d1cfecbed9612f041d6fffa11e91e18a72f633 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 20 Apr 2016 15:26:49 +0200 Subject: [PATCH] Fix compilation errors (in the Polyhedron Demo) --- .gitignore | 3 + .../CGAL/Labeled_image_mesh_domain_3.h | 7 +- Mesh_3/include/CGAL/Labeled_mesh_domain_3.h | 91 ++++++++++++++----- .../Image_to_labeled_function_wrapper.h | 6 +- ...hedron_demo_mesh_3_labeled_mesh_domain_3.h | 8 +- 5 files changed, 83 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 5903990f796..4c7cfa51a07 100644 --- a/.gitignore +++ b/.gitignore @@ -453,12 +453,15 @@ Mesh_3/examples/Mesh_3/test_off /Mesh_3/test/Mesh_3/test_mesh_3_implicit_vector_to_labeled_function_wrapper /Mesh_3/test/Mesh_3/test_mesh_3_labeled_mesh_domain_3 /Mesh_3/test/Mesh_3/test_mesh_criteria_creation +/Mesh_3/test/Mesh_3/test_mesh_implicit_domains /Mesh_3/test/Mesh_3/test_meshing_3D_gray_image /Mesh_3/test/Mesh_3/test_meshing_3D_image +/Mesh_3/test/Mesh_3/test_meshing_determinism /Mesh_3/test/Mesh_3/test_meshing_implicit_function /Mesh_3/test/Mesh_3/test_meshing_polyhedron /Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features /Mesh_3/test/Mesh_3/test_meshing_polylines_only +/Mesh_3/test/Mesh_3/test_meshing_unit_tetrahedron /Mesh_3/test/Mesh_3/test_off /Mesh_3/test/Mesh_3/test_robust_weighted_circumcenter /Mesh_3/test/Mesh_3/test-tetgen.elem 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 3b7653fc4de..79644021982 100644 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h @@ -74,13 +74,15 @@ public: typedef typename Base::FT FT; typedef BGT Geom_traits; typedef CGAL::Bbox_3 Bbox_3; + typedef CGAL::Identity Identity; /// Constructor Labeled_image_mesh_domain_3(const Image& image, const FT& error_bound = FT(1e-3), + Subdomain_index value_outside = 0, Null null = Null(), CGAL::Random* p_rng = NULL) - : Base(Wrapper(image), + : Base(Wrapper(image, Identity(), value_outside), compute_bounding_box(image), error_bound, null, @@ -90,9 +92,10 @@ public: Labeled_image_mesh_domain_3(const Image& image, const CGAL::Bbox_3& bbox, const FT& error_bound = FT(1e-3), + Subdomain_index value_outside = 0, Null null = Null(), CGAL::Random* p_rng = NULL) - : Base(Wrapper(image), + : Base(Wrapper(image, Identity(), value_outside), bbox, error_bound, null, diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 67c9e60cd5e..af50ca3245f 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -122,6 +122,20 @@ public: Null null = Null(), CGAL::Random* p_rng = NULL); + Labeled_mesh_domain_3(const Function& f, + const Sphere_3& bounding_sphere, + const FT& error_bound, + CGAL::Random* p_rng); + + Labeled_mesh_domain_3(const Function& f, + const Bbox_3& bbox, + const FT& error_bound, + CGAL::Random* p_rng); + + Labeled_mesh_domain_3(const Function& f, + const Iso_cuboid_3& bbox, + const FT& error_bound, + CGAL::Random* p_rng); /// Destructor virtual ~Labeled_mesh_domain_3() { @@ -528,16 +542,10 @@ Labeled_mesh_domain_3::Labeled_mesh_domain_3( : function_(f) , bbox_(iso_cuboid(bounding_sphere.bbox())) , null(null) -, p_rng_(p_rng) -, delete_rng_(false) +, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng) +, delete_rng_(p_rng == 0) , squared_error_bound_(squared_error_bound(bounding_sphere,error_bound)) { - // TODO : CGAL_ASSERT(0 < f(bounding_sphere.get_center()) ) ? - if(!p_rng_) - { - p_rng_ = new CGAL::Random(0); - delete_rng_ = true; - } } template @@ -550,16 +558,10 @@ Labeled_mesh_domain_3::Labeled_mesh_domain_3( : function_(f) , bbox_(iso_cuboid(bbox)) , null(null) -, p_rng_(p_rng) -, delete_rng_(false) +, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng) +, delete_rng_(p_rng == 0) , squared_error_bound_(squared_error_bound(bbox_,error_bound)) { - // TODO : CGAL_ASSERT(0 < f(bounding_sphere.get_center()) ) ? - if(!p_rng_) - { - p_rng_ = new CGAL::Random(0); - delete_rng_ = true; - } } template @@ -572,20 +574,61 @@ Labeled_mesh_domain_3::Labeled_mesh_domain_3( : function_(f) , bbox_(bbox) , null(null) -, p_rng_(p_rng) -, delete_rng_(false) +, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng) +, delete_rng_(p_rng == 0) , squared_error_bound_(squared_error_bound(bbox_,error_bound)) { - // TODO : CGAL_ASSERT(0 < f( bbox.get_center()) ) ? - if(!p_rng_) - { - p_rng_ = new CGAL::Random(0); - delete_rng_ = true; - } } + +template +Labeled_mesh_domain_3::Labeled_mesh_domain_3( + const F& f, + const Sphere_3& bounding_sphere, + const FT& error_bound, + CGAL::Random* p_rng) +: function_(f) +, bbox_(iso_cuboid(bounding_sphere.bbox())) +, null(Null()) +, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng) +, delete_rng_(p_rng == 0) +, squared_error_bound_(squared_error_bound(bounding_sphere,error_bound)) +{ +} + +template +Labeled_mesh_domain_3::Labeled_mesh_domain_3( + const F& f, + const Bbox_3& bbox, + const FT& error_bound, + CGAL::Random* p_rng) +: function_(f) +, bbox_(iso_cuboid(bbox)) +, null(Null()) +, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng) +, delete_rng_(p_rng == 0) +, squared_error_bound_(squared_error_bound(bbox_,error_bound)) +{ +} + +template +Labeled_mesh_domain_3::Labeled_mesh_domain_3( + const F& f, + const Iso_cuboid_3& bbox, + const FT& error_bound, + CGAL::Random* p_rng) +: function_(f) +, bbox_(bbox) +, null(Null()) +, p_rng_(p_rng == 0 ? new CGAL::Random(0) : p_rng) +, delete_rng_(p_rng == 0) +, squared_error_bound_(squared_error_bound(bbox_,error_bound)) +{ +} + + template template OutputIterator diff --git a/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h b/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h index 0e89f72418a..3f933c9e743 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h +++ b/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h @@ -46,7 +46,7 @@ template, + typename Transform = Identity, bool labeled_image = true, bool use_trilinear_interpolation=true> class Image_to_labeled_function_wrapper @@ -65,7 +65,6 @@ public: , transform(transform) , value_outside(value_outside) { - CGAL_assertion(transform(value_outside) == return_type()); } // Default copy constructor and assignment operator are ok @@ -92,12 +91,11 @@ public: value_outside))); } else { return static_cast(transform( - static_cast( r_im_.template trilinear_interpolation( CGAL::to_double(p.x()), CGAL::to_double(p.y()), CGAL::to_double(p.z()), - value_outside)))); + value_outside))); } } else diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h index a866dac3f5b..9b7b9dd6b63 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Polyhedron_demo_mesh_3_labeled_mesh_domain_3.h @@ -71,14 +71,18 @@ public: const typename Base::Bbox_3& bbox, const typename Base::FT& error_bound = Base::FT(1e-3), CGAL::Random* p_rng = NULL) - : Base(f, bbox, error_bound, Null_subdomain_index(), p_rng) + : Base(f, bbox, error_bound, + // Subdomain_index(), Null_subdomain_index(), + p_rng) {} Polyhedron_demo_labeled_mesh_domain_3( const Image& img, const typename Base::FT& error_bound = Base::FT(1e-3), CGAL::Random* p_rng = NULL) - : Base(img, error_bound, Null_subdomain_index(), p_rng) + : Base(img, error_bound, + // Subdomain_index(), Null_subdomain_index(), + p_rng) {} /**