diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h index e91c09e2a4b..e96dfa58b46 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshDomain_3.h @@ -178,6 +178,15 @@ typedef unspecified_type Construct_intersection; /// @} +/// \name Bounding box +/// Since CGAL-4.8, a model of `MeshDomain_3` must provide a function +/// providing a bounding box of the domain. +/// @{ + +/// Return the bounding box of the domain +Bbox_3 bbox() const; +/// @} + /// \name Operations /// The following functions give access to the function objects: /// @{ diff --git a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h index 5adbe5b7e30..1801e8b3729 100644 --- a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h @@ -74,7 +74,7 @@ public: /// Destructor virtual ~Implicit_mesh_domain_3() {} - + using Base::bbox; private: // Disabled copy constructor & assignment operator typedef Implicit_mesh_domain_3 Self; 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 62eefd5afe6..4b24a848550 100644 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h @@ -77,6 +77,7 @@ public: /// Destructor virtual ~Labeled_image_mesh_domain_3() {} + using Base::bbox; private: /// Returns a box enclosing image \c im diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index f7924b68188..7d85d1bad97 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -142,6 +142,13 @@ public: return Construct_initial_points(*this); } + /** + * Returns a bounding box of the domain + */ + Bbox_3 bbox() const { + return bbox_.bbox(); + } + /** * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the * domain, the parameter index is set to the index of the subdomain diff --git a/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h index 39713d977c6..52e4c47cbc7 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h @@ -118,6 +118,13 @@ public: delete p_rng_; } + /** + * Returns a bounding box of the domain + */ + Bbox_3 bbox() const { + return this->bbox_.bbox(); + } + /** * Constructs a set of \ccc{n} points on the surface, and output them to * the output iterator \ccc{pts} whose value type is required to be diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index b9ef1c603c8..04a236ab8a4 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -484,27 +484,11 @@ initialize() #if defined(CGAL_LINKED_WITH_TBB) || \ defined(CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE) - Bbox_3 estimated_bbox; - CGAL_assertion_code(bool is_estimated_bbox_initialized = false); - #ifndef CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE if(boost::is_convertible::value) #endif // If that macro is defined, then estimated_bbox must be initialized { - typedef std::vector > Points_vector; - Points_vector random_points_on_surface; - r_oracle_.construct_initial_points_object()( - std::back_inserter(random_points_on_surface), 1000); - typename Points_vector::const_iterator - it = random_points_on_surface.begin(), - it_end = random_points_on_surface.end(); - estimated_bbox = it->first.bbox(); - ++it; - for( ; it != it_end ; ++it) - estimated_bbox = estimated_bbox + it->first.bbox(); - - Base::set_bbox(estimated_bbox); - CGAL_assertion_code(is_estimated_bbox_initialized = true); + Base::set_bbox(r_oracle_.bbox()); } #endif // CGAL_LINKED_WITH_TBB||"sequential use far sphere" @@ -523,8 +507,7 @@ initialize() if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0) { - CGAL_assertion(is_estimated_bbox_initialized); - const Bbox_3 &bbox = estimated_bbox; + const Bbox_3 &bbox = r_oracle_.bbox(); // Compute radius for far sphere const double xdelta = bbox.xmax()-bbox.xmin(); diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 5e37b177149..13ffb75e30d 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -367,6 +367,14 @@ public: } + /** + * Returns a bounding box of the domain + */ + Bbox_3 bbox() const { + return tree_.bbox(); + } + + /** * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the * domain, the parameter index is set to the index of the subdomain