20 #ifndef LIBMESH_BOUNDING_BOX_H 21 #define LIBMESH_BOUNDING_BOX_H 24 #include "libmesh/libmesh.h" 25 #include "libmesh/point.h" 45 const Point & new_max) :
67 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
69 this->first(i) = std::numeric_limits<Real>::max();
70 this->second(i) = -std::numeric_limits<Real>::max();
78 {
return this->first; }
81 {
return this->first; }
87 {
return this->second; }
90 {
return this->second; }
217 for (
unsigned int dir=0; dir<LIBMESH_DIM; ++dir)
218 if (my_lower(dir) > other_lower(dir) ||
219 other_upper(dir) > my_upper(dir))
241 for (
unsigned int dir=0; dir<LIBMESH_DIM; ++dir)
252 if (!((my_lower(dir) <= other_lower(dir) &&
253 other_lower(dir) <= my_upper(dir)) ||
254 (my_lower(dir) <= other_upper(dir) &&
255 other_upper(dir) <= my_upper(dir))) &&
256 !((other_lower(dir) <= my_lower(dir) &&
257 my_lower(dir) <= other_upper(dir))))
276 for (
unsigned int dir=0; dir<LIBMESH_DIM; ++dir)
278 expanded_my_box.first(dir) -= abstol;
279 expanded_my_box.second(dir) += abstol;
288 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
290 min()(i) = std::min(
min()(i), p(i));
291 max()(i) = std::max(
max()(i), p(i));
298 #endif // LIBMESH_BOUNDING_BOX_H friend std::ostream & operator<<(std::ostream &os, const BoundingBox &b)
Formatted print as above but supports the syntax:
BoundingBox()
Default constructor sets invalid bounds.
bool contains_point(const Point &) const
BoundingBox(const std::pair< Point, Point > &bbox)
void intersect_with(const BoundingBox &)
Sets this bounding box to be the intersection with the other bounding box.
bool intersects(const BoundingBox &) const
void invalidate()
Sets the bounding box to be "inverted".
The libMesh namespace provides an interface to certain functionality in the library.
Real signed_distance(const Point &p) const
Computes the signed distance, d, from a given Point p to this BoundingBox.
const Point & min() const
Real max_size() const
Returns the maximum size of a finite box extent.
void print(std::ostream &os=libMesh::out) const
Formatted print, by default to libMesh::out.
BoundingBox(const Point &new_min, const Point &new_max)
Defines a Cartesian bounding box by the two corner extremum.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool contains(const BoundingBox &) const
void union_with(const Point &p)
Enlarges this bounding box to include the given point.
const Point & max() const
void scale(const Real factor)
Scales each dimension of the bounding box by factor.
A Point defines a location in LIBMESH_DIM dimensional Real space.