AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.3.3/src/axom/primal/geometry/BoundingBox.hpp>
Public Types | |
typedef T | CoordType |
typedef Point< T, NDIMS > | PointType |
typedef Vector< T, NDIMS > | VectorType |
typedef BoundingBox< T, NDIMS > | BoxType |
Public Member Functions | |
BoundingBox () | |
Constructor. Creates a bounding box with an invalid bound The lower bound is set to the greatest possible point and the upper bound is set to the smallest possible point. This way adding any point resets the bounds to a valid range. More... | |
BoundingBox (const PointType &pt) | |
Constructor. Creates a bounding box containing a single point. More... | |
BoundingBox (const PointType *pts, int n) | |
Constructor. Creates a bounding box containing the collection of points. More... | |
BoundingBox (const PointType &lowerPt, const PointType &upperPt) | |
Constructor. Creates a bounding box with a given min and max point The code ensures that the bounds are valid. More... | |
BoundingBox (const BoundingBox &other) | |
Copy Constructor. More... | |
~BoundingBox () | |
Destructor. More... | |
void | clear () |
Resets the bounds to those of the default constructor. More... | |
const PointType & | getMin () const |
Returns const reference to the min corner of the bounding box. More... | |
const PointType & | getMax () const |
Returns const reference to the max corner of the bounding box. More... | |
PointType | getCentroid () const |
Returns the centroid (midpoint) of the bounding box. More... | |
VectorType | range () const |
Returns a vector from the min to the max points of the bounding box. More... | |
template<typename OtherType > | |
void | addPoint (const Point< OtherType, NDIMS > &pt) |
Updates bounds to include the provided point. More... | |
template<typename OtherType > | |
void | addBox (const BoundingBox< OtherType, NDIMS > &bbox) |
Updates bounds to include the provided bounding box. Convenience function – equivalent to adding the min and max point of bbox. More... | |
int | dimension () const |
Returns the dimension of the ambient space for this bounding box. More... | |
int | getLongestDimension () const |
Finds the longest dimension of the bounding box. More... | |
BoundingBox & | intersect (const BoundingBox &otherBox) |
Intersects the current bounding box with another bounding box. More... | |
BoundingBox & | expand (T expansionAmount) |
Expands the lower and upper bounds by the given amount. More... | |
BoundingBox & | scale (double scaleFactor) |
Scales the bounding box about its center by a given amount. More... | |
BoundingBox & | shift (const VectorType &displacement) |
Shifts the bounding box by a fixed displacement. More... | |
BoundingBox & | operator= (const BoundingBox &rhs) |
Overloaded assignment operator. More... | |
template<typename OtherType > | |
bool | contains (const Point< OtherType, NDIMS > &otherPt) const |
Checks whether the box contains the point. More... | |
template<typename OtherType > | |
bool | contains (const BoundingBox< OtherType, NDIMS > &otherBB) const |
Checks whether the box fully contains another bounding box. More... | |
template<typename OtherType > | |
bool | intersectsWith (const BoundingBox< OtherType, NDIMS > &otherBB) const |
bool | isValid () const |
Checks that we have a valid bounding box. More... | |
void | bisect (BoxType &right, BoxType &left, int dimension=-1) const |
Subdivides this bounding box instance into two sub-boxes by splitting along the given dimension. If a dimension is not provided, this method will split the bounding box along the longest dimension. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of a bounding box instance. More... | |
template<typename OtherT > | |
bool | contains (const Point< OtherT, NDIMS > &otherPt) const |
template<typename OtherT > | |
bool | contains (const BoundingBox< OtherT, NDIMS > &otherBB) const |
template<typename OtherT > | |
void | addPoint (const Point< OtherT, NDIMS > &pt) |
template<typename OtherT > | |
void | addBox (const BoundingBox< OtherT, NDIMS > &bbox) |
Static Public Member Functions | |
Static methods | |
static void | getPoints (const BoundingBox< T, 2 > &bb, std::vector< Point< T, 2 > > &pnts) |
Returns the list of points of a 2-D BoundingBox instance. More... | |
static void | getPoints (const BoundingBox< T, 3 > &bb, std::vector< Point< T, 3 > > &pnts) |
Returns the list of points of a 3-D BoundingBox instance. More... | |
typedef T axom::primal::BoundingBox< T, NDIMS >::CoordType |
typedef Point< T,NDIMS > axom::primal::BoundingBox< T, NDIMS >::PointType |
typedef Vector< T,NDIMS > axom::primal::BoundingBox< T, NDIMS >::VectorType |
typedef BoundingBox< T,NDIMS > axom::primal::BoundingBox< T, NDIMS >::BoxType |
|
inline |
Constructor. Creates a bounding box with an invalid bound The lower bound is set to the greatest possible point and the upper bound is set to the smallest possible point. This way adding any point resets the bounds to a valid range.
Referenced by axom::primal::BoundingBox< double, DIM >::BoundingBox().
|
inline |
Constructor. Creates a bounding box containing a single point.
axom::primal::BoundingBox< T, NDIMS >::BoundingBox | ( | const PointType * | pts, |
int | n | ||
) |
Constructor. Creates a bounding box containing the collection of points.
|
inline |
Constructor. Creates a bounding box with a given min and max point The code ensures that the bounds are valid.
|
inline |
Copy Constructor.
[in] | other | The bounding box to copy |
|
inline |
Destructor.
void axom::primal::BoundingBox< T, NDIMS >::clear | ( | ) |
Resets the bounds to those of the default constructor.
Referenced by axom::primal::BoundingBox< double, DIM >::BoundingBox(), axom::primal::BoundingBox< double, DIM >::intersect(), and axom::primal::BoundingBox< double, DIM >::~BoundingBox().
|
inline |
Returns const reference to the min corner of the bounding box.
Referenced by axom::primal::BoundingBox< double, DIM >::addBox(), axom::primal::BoundingBox< double, DIM >::bisect(), axom::spin::SpatialOctree< DIM, InOutBlockData >::blockBoundingBox(), axom::primal::clip(), axom::primal::BoundingBox< double, DIM >::contains(), axom::spin::BVHTree< T, NDIMS >::empty(), axom::spin::SpatialOctree< DIM, InOutBlockData >::findGridCellAtLevel(), axom::spin::UniformGrid< T, NDIMS >::getBinsForBbox(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::getCandidates(), axom::primal::BoundingBox< double, DIM >::getPoints(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::insert(), axom::primal::operator==(), axom::spin::rectangular_lattice_from_bounding_box(), and axom::primal::squared_distance().
|
inline |
Returns const reference to the max corner of the bounding box.
Referenced by axom::primal::BoundingBox< double, DIM >::addBox(), axom::primal::BoundingBox< double, DIM >::bisect(), axom::primal::clip(), axom::primal::BoundingBox< double, DIM >::contains(), axom::spin::BVHTree< T, NDIMS >::empty(), axom::spin::UniformGrid< T, NDIMS >::getBinsForBbox(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::getCandidates(), axom::primal::BoundingBox< double, DIM >::getPoints(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::insert(), axom::primal::operator==(), axom::spin::rectangular_lattice_from_bounding_box(), and axom::primal::squared_distance().
|
inline |
Returns the centroid (midpoint) of the bounding box.
Referenced by axom::primal::BoundingBox< double, DIM >::scale().
|
inline |
Returns a vector from the min to the max points of the bounding box.
Referenced by axom::spin::ImplicitGrid< NDIMS, TheIndexType >::initialize(), axom::primal::BoundingBox< double, DIM >::print(), axom::primal::BoundingBox< double, DIM >::scale(), and axom::spin::SpatialOctree< DIM, InOutBlockData >::SpatialOctree().
void axom::primal::BoundingBox< T, NDIMS >::addPoint | ( | const Point< OtherType, NDIMS > & | pt | ) |
Updates bounds to include the provided point.
[in] | pt | to include. |
Referenced by axom::primal::BoundingBox< double, DIM >::addBox(), axom::primal::BoundingBox< double, DIM >::BoundingBox(), axom::quest::SignedDistance< NDIMS >::computeDistance(), axom::primal::BoundingBox< double, DIM >::range(), and axom::quest::SignedDistance< NDIMS >::SignedDistance().
void axom::primal::BoundingBox< T, NDIMS >::addBox | ( | const BoundingBox< OtherType, NDIMS > & | bbox | ) |
Updates bounds to include the provided bounding box. Convenience function – equivalent to adding the min and max point of bbox.
[in] | bbox | to include. |
Referenced by axom::primal::merge_boxes(), and axom::primal::BoundingBox< double, DIM >::range().
|
inline |
Returns the dimension of the ambient space for this bounding box.
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
int axom::primal::BoundingBox< T, NDIMS >::getLongestDimension | ( | ) | const |
Finds the longest dimension of the bounding box.
Referenced by axom::primal::BoundingBox< double, DIM >::bisect(), and axom::primal::BoundingBox< double, DIM >::dimension().
BoundingBox< T, NDIMS > & axom::primal::BoundingBox< T, NDIMS >::intersect | ( | const BoundingBox< T, NDIMS > & | otherBox | ) |
Intersects the current bounding box with another bounding box.
[in] | otherBox | The other box to intersect |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
BoundingBox< T, NDIMS > & axom::primal::BoundingBox< T, NDIMS >::expand | ( | T | expansionAmount | ) |
Expands the lower and upper bounds by the given amount.
[in] | expansionAmount | an absolute amount to expand |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension(), and axom::spin::ImplicitGrid< NDIMS, TheIndexType >::insert().
BoundingBox< T, NDIMS > & axom::primal::BoundingBox< T, NDIMS >::scale | ( | double | scaleFactor | ) |
Scales the bounding box about its center by a given amount.
[in] | scaleFactor | the multiplicative factor by which to scale |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension(), and axom::spin::UniformGrid< T, NDIMS >::UniformGrid().
BoundingBox< T, NDIMS > & axom::primal::BoundingBox< T, NDIMS >::shift | ( | const VectorType & | displacement | ) |
Shifts the bounding box by a fixed displacement.
[in] | displacement | the amount with which to move the bounding box |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
BoundingBox< T, NDIMS > & axom::primal::BoundingBox< T, NDIMS >::operator= | ( | const BoundingBox< T, NDIMS > & | rhs | ) |
Overloaded assignment operator.
[in] | rhs | bounding box instance on the right-hand side |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
bool axom::primal::BoundingBox< T, NDIMS >::contains | ( | const Point< OtherType, NDIMS > & | otherPt | ) | const |
Checks whether the box contains the point.
[in] | otherPt | the point that we are checking |
Referenced by axom::primal::clip(), axom::quest::SignedDistance< NDIMS >::computeDistance(), axom::primal::BoundingBox< double, DIM >::contains(), axom::primal::BoundingBox< double, DIM >::dimension(), axom::spin::SpatialOctree< DIM, InOutBlockData >::findLeafBlock(), axom::spin::UniformGrid< T, NDIMS >::getBinIndex(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::getCandidates(), axom::spin::BVHTree< T, NDIMS >::insert(), and axom::primal::squared_distance().
bool axom::primal::BoundingBox< T, NDIMS >::contains | ( | const BoundingBox< OtherType, NDIMS > & | otherBB | ) | const |
Checks whether the box fully contains another bounding box.
[in] | otherBB | the bounding box that we are checking |
bool axom::primal::BoundingBox< T, NDIMS >::intersectsWith | ( | const BoundingBox< OtherType, NDIMS > & | otherBB | ) | const |
[in] | otherBB | the bounding box that we are checking. |
Referenced by axom::primal::clip(), axom::primal::BoundingBox< double, DIM >::dimension(), axom::spin::UniformGrid< T, NDIMS >::getBinsForBbox(), axom::spin::ImplicitGrid< NDIMS, TheIndexType >::getCandidates(), and axom::primal::intersect().
bool axom::primal::BoundingBox< T, NDIMS >::isValid | ( | ) | const |
Checks that we have a valid bounding box.
Referenced by axom::primal::BoundingBox< double, DIM >::bisect(), axom::primal::BoundingBox< double, DIM >::dimension(), axom::primal::BoundingBox< double, DIM >::getLongestDimension(), axom::spin::BVHTree< T, NDIMS >::insert(), and axom::primal::BoundingBox< double, DIM >::intersect().
void axom::primal::BoundingBox< T, NDIMS >::bisect | ( | BoxType & | right, |
BoxType & | left, | ||
int | dimension = -1 |
||
) | const |
Subdivides this bounding box instance into two sub-boxes by splitting along the given dimension. If a dimension is not provided, this method will split the bounding box along the longest dimension.
[in,out] | right | the right sub-box. |
[in,out] | left | the left sub-box. |
[in] | dimension | the dimension to split along (optional) |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
std::ostream & axom::primal::BoundingBox< T, NDIMS >::print | ( | std::ostream & | os | ) | const |
Simple formatted print of a bounding box instance.
os | The output stream to write to |
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
|
inlinestatic |
Returns the list of points of a 2-D BoundingBox instance.
[in] | bb | user-supplied instance of the bounding box. |
[out] | pnts | the list of points |
* * 3 2 * +------+ * | | * | | * +------+ * 0 1 * *
Referenced by axom::primal::BoundingBox< double, DIM >::dimension().
|
inlinestatic |
Returns the list of points of a 3-D BoundingBox instance.
[in] | bb | user-supplied instance of the bounding box. |
[out] | pnts | the list of points |
* * 4 7 * +----------+ * /| /| * 5 / | 6 / | * +--|-------+ | * | +-------|--+ * | / 0 | / 3 * |/ |/ * +----------+ * 1 2 * *
bool axom::primal::BoundingBox< T, NDIMS >::contains | ( | const Point< OtherT, NDIMS > & | otherPt | ) | const |
bool axom::primal::BoundingBox< T, NDIMS >::contains | ( | const BoundingBox< OtherT, NDIMS > & | otherBB | ) | const |
void axom::primal::BoundingBox< T, NDIMS >::addPoint | ( | const Point< OtherT, NDIMS > & | pt | ) |
void axom::primal::BoundingBox< T, NDIMS >::addBox | ( | const BoundingBox< OtherT, NDIMS > & | bbox | ) |