olp-cpp-sdk
1.22.0
|
The aligned bounding-box implementation. More...
#include <AlignedBox.h>
Public Types | |
using | ValueType = T |
An alias for the box value type. | |
using | OverflowType = typename OverflowTrait< T >::Type |
An alias for the overflow trait. | |
using | VectorType = Vector< ValueType, N > |
An alias for the vector type of the box. | |
using | OverflowVectorType = Vector< OverflowType, N > |
An alias for the overflow vector type. | |
using | CornerArrayType = typename std::array< VectorType, numCorners > |
An alias for the corner points array type. | |
Public Member Functions | |
AlignedBox () | |
Creates an AlignedBox instance. More... | |
AlignedBox (const VectorType &min, const VectorType &max) | |
Creates an AlignedBox instance. More... | |
template<typename OtherT > | |
AlignedBox (const AlignedBox< OtherT, N > &other) | |
Creates a copy of the AlignedBox instance. More... | |
void | Reset () |
Resets the box to empty. | |
void | Reset (const VectorType &min, const VectorType &max) |
Resets the box to the new minimum and maximum points. More... | |
bool | Empty () const |
Tests whether the box is empty. More... | |
VectorType | Center () const |
Gets the center point of the box. More... | |
VectorType | Size () const |
Gets the size of the box. More... | |
const VectorType & | Minimum () const |
Gets the box minimum corner point. More... | |
const VectorType & | Maximum () const |
Gets the box maximum corner point. More... | |
CornerArrayType | Corners () const |
Gets the corner points of the box. More... | |
bool | Contains (const VectorType &point, T epsilon=T()) const |
Tests whether the box contains a point. More... | |
bool | Contains (const AlignedBox &box) const |
Tests whether the box contains another box. More... | |
bool | Intersects (const AlignedBox &box) const |
Tests whether the box intersects another box. More... | |
VectorType | NearestPoint (const VectorType &point) const |
Computes the nearest point on the box to a point. More... | |
ValueType | Distance (const VectorType &point) const |
Computes the distance from a point to the box. More... | |
ValueType | Distance2 (const VectorType &point) const |
Computes the squared distance from a point to the box. More... | |
bool | operator== (const AlignedBox &box) const |
Checks whether two boxes are equal. More... | |
bool | operator!= (const AlignedBox &box) const |
Checks whether two boxes are not equal. More... | |
Static Public Attributes | |
static const unsigned int | numCorners = 1 << N |
The number of corners for the box. | |
static const unsigned int | dimensions = N |
The box dimensions. | |
The aligned bounding-box implementation.
T | The real type. |
N | The box dimensions. |
olp::math::AlignedBox< T, N >::AlignedBox |
Creates an AlignedBox
instance.
An empty box is created.
olp::math::AlignedBox< T, N >::AlignedBox | ( | const VectorType & | min, |
const VectorType & | max | ||
) |
Creates an AlignedBox
instance.
If any component of min
is greater than max
, an empty box is created.
[in] | min | The box minimum point. |
[in] | max | The box maximum point. |
olp::math::AlignedBox< T, N >::AlignedBox | ( | const AlignedBox< OtherT, N > & | other | ) |
Creates a copy of the AlignedBox
instance.
OtherT | The real type of the box being copied. |
[in] | other | The box to be copied. |
AlignedBox< T, N >::VectorType olp::math::AlignedBox< T, N >::Center |
Gets the center point of the box.
The center of an empty box is undefined.
bool olp::math::AlignedBox< T, N >::Contains | ( | const AlignedBox< T, N > & | box | ) | const |
Tests whether the box contains another box.
[in] | box | The aligned box. |
bool olp::math::AlignedBox< T, N >::Contains | ( | const VectorType & | point, |
T | epsilon = T() |
||
) | const |
Tests whether the box contains a point.
This test is inclusive.
point | The point to be tested. |
epsilon | The epsilon around the point. |
CornerArrayType olp::math::AlignedBox< T, N >::Corners | ( | ) | const |
Gets the corner points of the box.
The corner points of an empty box are undefined.
auto olp::math::AlignedBox< T, N >::Distance | ( | const VectorType & | point | ) | const |
Computes the distance from a point to the box.
A point on or inside the box has a distance of zero.
The distance to an empty box is undefined.
[in] | point | The point from which to find the distance. |
auto olp::math::AlignedBox< T, N >::Distance2 | ( | const VectorType & | point | ) | const |
Computes the squared distance from a point to the box.
A point on or inside the box has a squared distance of zero.
The squared distance to an empty box is undefined.
[in] | point | The point from which to find the squared distance. |
bool olp::math::AlignedBox< T, N >::Empty |
Tests whether the box is empty.
bool olp::math::AlignedBox< T, N >::Intersects | ( | const AlignedBox< T, N > & | box | ) | const |
Tests whether the box intersects another box.
A test box is considered to be intersecting if another box contains it.
[in] | box | The box to be tested. |
const AlignedBox< T, N >::VectorType & olp::math::AlignedBox< T, N >::Maximum |
Gets the box maximum corner point.
The maximum corner point of an empty box is undefined.
const AlignedBox< T, N >::VectorType & olp::math::AlignedBox< T, N >::Minimum |
Gets the box minimum corner point.
The minimum corner point of an empty box is undefined.
VectorType olp::math::AlignedBox< T, N >::NearestPoint | ( | const VectorType & | point | ) | const |
Computes the nearest point on the box to a point.
The nearest point to an empty box is undefined.
[in] | point | The point from which to find the nearest point. |
bool olp::math::AlignedBox< T, N >::operator!= | ( | const AlignedBox< T, N > & | box | ) | const |
Checks whether two boxes are not equal.
[in] | box | The other box. |
bool olp::math::AlignedBox< T, N >::operator== | ( | const AlignedBox< T, N > & | box | ) | const |
Checks whether two boxes are equal.
[in] | box | The other box. |
void olp::math::AlignedBox< T, N >::Reset | ( | const VectorType & | min, |
const VectorType & | max | ||
) |
Resets the box to the new minimum and maximum points.
If any component of min
is greater than max
, an empty box is created.
[in] | min | The box minimum point. |
[in] | max | The box maximum point. |
AlignedBox< T, N >::VectorType olp::math::AlignedBox< T, N >::Size |
Gets the size of the box.
The size of an empty box is zero.
max
is INT_MAX
and min
is INT_MIN
.