Add bbox() to MeshDomain_3

This commit is contained in:
Laurent Rineau 2015-12-16 11:52:52 +01:00
parent 0c917c5880
commit 2af8d42ed3
7 changed files with 35 additions and 20 deletions

View File

@ -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:
/// @{

View File

@ -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<Function,BGT> Self;

View File

@ -77,6 +77,7 @@ public:
/// Destructor
virtual ~Labeled_image_mesh_domain_3() {}
using Base::bbox;
private:
/// Returns a box enclosing image \c im

View File

@ -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

View File

@ -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

View File

@ -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<Concurrency_tag, Parallel_tag>::value)
#endif // If that macro is defined, then estimated_bbox must be initialized
{
typedef std::vector<std::pair<Point, Index> > 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();

View File

@ -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