GenericAABB represents an axis-aligned bounding box.
T | The data type used to store the minimal and maximal corner points. May be float, double or long double. |
#include <GenericAABB.h>
Classes | |
struct | MinMaxCornerGivenT |
Public Types | |
using | value_type = T |
using | vector_type = Vector3< T > |
scalar data type More... | |
Public Member Functions | |
GenericAABB () | |
data type for three dimensional vectors More... | |
template<typename U > | |
GenericAABB (const GenericAABB< U > &other) | |
Copy constructor for GenericAABBs of different value_type. More... | |
GenericAABB (const vector_type &corner0, const vector_type &corner1) | |
Builds a GenericAABB from two arbitrary points. More... | |
GenericAABB (const value_type x0, const value_type y0, const value_type z0, const value_type x1, const value_type y1, const value_type z1) | |
Builds a GenericAABB from two arbitrary points given with their coordinates. More... | |
template<typename InputIterator > | |
GenericAABB (InputIterator first, InputIterator last) | |
Builds a default GenericAABB by merging a Sequence of points or GenericAABBs. More... | |
template<typename U > | |
GenericAABB & | operator= (const GenericAABB< U > &other) |
const vector_type & | minCorner () const |
Provides access to the corner with minimal values. More... | |
const vector_type & | maxCorner () const |
Provides access to the corner with maximal values. More... | |
const vector_type & | min () const |
const vector_type & | max () const |
value_type | xMin () const |
Provides access to the x-component of the corner with minimal values. More... | |
value_type | yMin () const |
Provides access to the y-component of the corner with minimal values. More... | |
value_type | zMin () const |
Provides access to the z-component of the corner with minimal values. More... | |
value_type | min (const uint_t index) const |
value_type | xMax () const |
Provides access to the x-component of the corner with maximal values. More... | |
value_type | yMax () const |
Provides access to the y-component of the corner with maximal values. More... | |
value_type | zMax () const |
Provides access to the z-component of the corner with maximal values. More... | |
value_type | max (const uint_t index) const |
bool | empty () const |
Checks whether the GenericAABB is empty. More... | |
vector_type | sizes () const |
Provides access to a vector of the genericAABBs extends. More... | |
value_type | size (const uint_t index) const |
Provides access to one of the extends of the genericAABB. More... | |
value_type | xSize () const |
Provides access to the extend of the genericAABB in x direction. More... | |
value_type | ySize () const |
Provides access to the extend of the genericAABB in y direction. More... | |
value_type | zSize () const |
Provides access to the extend of the genericAABB in z direction. More... | |
value_type | volume () const |
Calculates the volume of the genericAABB. More... | |
vector_type | center () const |
Calculates the center of the genericAABB. More... | |
bool | contains (const value_type x, const value_type y, const value_type z) const |
Tests whether a point lies within the GenericAABB. More... | |
bool | contains (const value_type x, const value_type y, const value_type z, const value_type dx) const |
Tests whether a point lies within the extended GenericAABB. More... | |
bool | contains (const vector_type &point) const |
Tests whether a point lies within the GenericAABB. More... | |
bool | contains (const vector_type &point, const value_type dx) const |
Tests whether a point lies within the extended GenericAABB. More... | |
bool | contains (const GenericAABB &other) const |
Tests whether an other GenericAABB lies within the GenericAABB. More... | |
bool | contains (const GenericAABB &other, const value_type dx) const |
Tests whether an other GenericAABB lies within the extended GenericAABB. More... | |
bool | containsClosedInterval (const vector_type &point) const |
Tests whether a point lies within the GenericAABB. More... | |
bool | containsClosedInterval (const vector_type &point, const value_type dx) const |
Tests whether a point lies within the extended GenericAABB. More... | |
GenericAABB | getExtended (const value_type eps) const |
Creates a new GenericAABB by extending this one. More... | |
GenericAABB | getExtended (const vector_type &eps) const |
Creates a new GenericAABB by extending this one. More... | |
GenericAABB | getTranslated (const vector_type &translation) const |
Creates a new GenericAABB by translating this one. More... | |
GenericAABB | getScaled (const value_type factor) const |
Creates a new GenericAABB by scaling this one. More... | |
GenericAABB | getScaled (const vector_type &factors) const |
Creates a new GenericAABB by scaling this one. More... | |
GenericAABB | getMerged (const vector_type &point) const |
Creates a new GenericAABB by merging this one with an additional point. More... | |
GenericAABB | getMerged (const GenericAABB &other) const |
Creates a new GenericAABB by merging this one with an other GenericAABB. More... | |
template<typename InputIterator > | |
GenericAABB | getMerged (InputIterator first, InputIterator last) const |
bool | intersects (const GenericAABB &other) const |
Tests whether this genericAABB intersects another GenericAABB. More... | |
bool | intersects (const GenericAABB &other, const value_type dx) const |
Tests whether this extended GenericAABB intersects another GenericAABB. More... | |
bool | intersectsClosedInterval (const GenericAABB &other) const |
Tests whether this genericAABB intersects another GenericAABB. More... | |
bool | intersectsClosedInterval (const GenericAABB &other, const value_type dx) const |
Tests whether this extended GenericAABB intersects another GenericAABB. More... | |
value_type | intersectionVolume (const GenericAABB &other) const |
Computes the volume of the intersection of this and another GenericAABB. More... | |
GenericAABB | getIntersection (const GenericAABB &other) const |
Computes the intersection of this and another GenericAABB. More... | |
bool | isIdentical (const GenericAABB &other) const |
Test whether this and another GenericAABB are exactly identical. More... | |
bool | isEqual (const GenericAABB &other) const |
Test whether this and another GenericAABB are equal. More... | |
value_type | sqDistance (const vector_type &point) const |
Computes the squared distance of point to this GenericAABB. More... | |
value_type | sqSignedDistance (const vector_type &point) const |
Computes the squared signed distance of point to this GenericAABB. More... | |
value_type | sqMaxDistance (const vector_type &point) const |
Computes the squared maximal distance of point to the far side of this GenericAABB. More... | |
value_type | distance (const vector_type &point) const |
Computes the distance of point to this GenericAABB. More... | |
value_type | signedDistance (const vector_type &point) const |
Computes the signed distance of point to this GenericAABB. More... | |
value_type | maxDistance (const vector_type &point) const |
Computes the maximal distance of point to the far side of this GenericAABB. More... | |
value_type | sqDistance (const GenericAABB &other) const |
Computes the distance between two GenericAABBs. More... | |
value_type | sqMaxDistance (const GenericAABB &other) const |
Computes the maximal distance of any two points from two GenericAABBs. More... | |
std::array< vector_type, 8 > | corners () const |
Computes the eight corners of this GenericAABB. More... | |
void | init () |
Reinitializes this GenericAABB with default values. More... | |
void | init (const vector_type &corner0, const vector_type &corner1) |
Reinitializes this GenericAABB from two arbitrary points. More... | |
void | init (const value_type x0, const value_type y0, const value_type z0, const value_type x1, const value_type y1, const value_type z1) |
Reinitializes this GenericAABB from two arbitrary points. More... | |
template<typename InputIterator > | |
void | init (InputIterator first, InputIterator last) |
Reinitializes this GenericAABB by merging a Sequence of points or GenericAABBs. More... | |
void | initMinMaxCorner (const vector_type &theMinCorner, const vector_type &theMaxCorner) |
Reinitializes this GenericAABB from a min- and a maxCorner. More... | |
void | initMinMaxCorner (const value_type minX, const value_type minY, const value_type minZ, const value_type maxX, const value_type maxY, const value_type maxZ) |
Reinitializes this GenericAABB from a min- and a maxCorner. More... | |
void | setAxisBounds (const uint_t index, const value_type value1, const value_type value2) |
Sets the minimum and maximum for one axis. More... | |
void | extend (const value_type eps) |
Extends this GenericAABB. More... | |
void | extend (const vector_type &eps) |
Extends this GenericAABB. More... | |
void | setCenter (const vector_type ¢er) |
Sets center of this GenericAABB. More... | |
void | translate (const vector_type &translation) |
Translates this GenericAABB. More... | |
void | scale (const value_type factor) |
Scales this GenericAABB. More... | |
void | scale (const vector_type &factors) |
Scales this GenericAABB. More... | |
void | merge (const vector_type &point) |
Merges this GenericAABB with an additional point. More... | |
void | merge (const GenericAABB &other) |
Merges this GenericAABB with an other GenericAABB. More... | |
template<typename InputIterator > | |
void | merge (InputIterator first, InputIterator last) |
Merges this GenericAABB with a Sequence of points or other GenericAABBs. More... | |
void | intersect (const GenericAABB &other) |
Intersects this with another GenericAABB. More... | |
template<typename Engine > | |
vector_type | randomPoint (Engine &engine) const |
Generates a random point uniformly distributed within the AABB. More... | |
bool | checkInvariant () const |
Tests whether the class invariant is satisfied. More... | |
template<typename U > | |
GenericAABB< T > & | operator= (const GenericAABB< U > &other) |
Assignment operator for GenericAABBs of different value_type. More... | |
template<typename InputIterator > | |
GenericAABB< T > | getMerged (InputIterator first, InputIterator last) const |
Creates a new GenericAABB by merging this one to a Sequence of points or other GenericAABBs. More... | |
Static Public Member Functions | |
static GenericAABB | createFromMinMaxCorner (const vector_type &theMinCorner, const vector_type &theMaxCorner) |
Builds a GenericAABB from a min- and a maxCorner. More... | |
static GenericAABB | createFromMinMaxCorner (const value_type minX, const value_type minY, const value_type minZ, const value_type maxX, const value_type maxY, const value_type maxZ) |
Builds a GenericAABB from a min- and a maxCorner. More... | |
Protected Member Functions | |
GenericAABB (const vector_type &theMinCorner, const vector_type &theMaxCorner, MinMaxCornerGivenT) | |
Helper type to distinguish ctors with equal signature. More... | |
GenericAABB (const value_type minX, const value_type minY, const value_type minZ, const value_type maxX, const value_type maxY, const value_type maxZ, MinMaxCornerGivenT) | |
Builds a GenericAABB from a min- and a maxCorner. More... | |
GenericAABB (const GenericAABB &lhs, const GenericAABB &rhs) | |
Builds a GenericAABB as an intersection of two other GenericAABBs. More... | |
Private Attributes | |
vector_type | minCorner_ |
vector_type | maxCorner_ |
minimal values More... | |
Friends | |
template<typename ET > | |
mpi::GenericRecvBuffer< ET > & | operator>> (mpi::GenericRecvBuffer< ET > &buf, GenericAABB< T > &aabb) |
Deserializes an GenericAABB from a mpi::GenericRecvBuffer. More... | |
using walberla::math::GenericAABB< T >::value_type = T |
using walberla::math::GenericAABB< T >::vector_type = Vector3<T> |
scalar data type
|
inline |
data type for three dimensional vectors
Builds a default GenericAABB.
|
inline |
Copy constructor for GenericAABBs of different value_type.
U | value_type of other GenericAABB |
other | other GenericAABB |
|
inline |
Builds a GenericAABB from two arbitrary points.
corner0 | first corner spanning the AABB |
corner1 | second corner spanning the AABB |
|
inline |
Builds a GenericAABB from two arbitrary points given with their coordinates.
x0 | x-coordinate of the first corner spanning the AABB |
y0 | y-coordinate of the first corner spanning the AABB |
z0 | z-coordinate of the first corner spanning the AABB |
x1 | x-coordinate of the second corner spanning the AABB |
y1 | y-coordinate of the second corner spanning the AABB |
z1 | z-coordinate of the second corner spanning the AABB |
|
inline |
Builds a default GenericAABB by merging a Sequence of points or GenericAABBs.
InputIterator | ForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >. |
first | first element of sequence [first, last) |
last | final element of sequence [first, last) |
|
inlineprotected |
Helper type to distinguish ctors with equal signature.
Builds a GenericAABB from a min- and a maxCorner.
theMinCorner | corner with minimal values |
theMaxCorner | corner with maximal values |
|
inlineprotected |
Builds a GenericAABB from a min- and a maxCorner.
minX | x-coordinate of the minCorner |
minY | y-coordinate of the minCorner |
minZ | z-coordinate of the minCorner |
maxX | x-coordinate of the maxCorner |
maxY | y-coordinate of the maxCorner |
maxZ | z-coordinate of the maxCorner |
|
inlineprotected |
Builds a GenericAABB as an intersection of two other GenericAABBs.
lhs | an arbitrary GenericAABB |
rhs | an arbitrary GenericAABB |
|
inline |
Calculates the center of the genericAABB.
bool walberla::math::GenericAABB< T >::checkInvariant |
Tests whether the class invariant is satisfied.
The invariant is minCorner.x <= maxCorner.x && minCorner.y <= maxCorner.y && minCorner.z <= maxCorner.z
|
inline |
Tests whether an other GenericAABB lies within the GenericAABB.
other | An other GenericAABB |
|
inline |
Tests whether an other GenericAABB lies within the extended GenericAABB.
other | An other GenericAABB |
dx | An epsilon the box is extended by in each direction before the test |
|
inline |
Tests whether a point lies within the GenericAABB.
This test interprets the boundaries of the GenericAABB as an half-open interval. The minimal values stored in minCorner are considered to belong to the bounding box while the maximal values stored in maxCorner are not.
x | x coordinate of the point to be tested for containment |
y | y coordinate of the point to be tested for containment |
z | z coordinate of the point to be tested for containment |
|
inline |
Tests whether a point lies within the extended GenericAABB.
This test interprets the boundaries of the GenericAABB as an half-open interval. The minimal values stored in minCorner are considered to belong to the bounding box while the maximal values stored in maxCorner are not.
x | x coordinate of the point to be tested for containment |
y | y coordinate of the point to be tested for containment |
z | z coordinate of the point to be tested for containment |
dx | An epsilon the box is extended by in each direction before the test |
|
inline |
Tests whether a point lies within the GenericAABB.
This test interprets the boundaries of the GenericAABB as an half-open interval. The minimal values stored in minCorner are considered to belong to the bounding box while the maximal values stored in maxCorner are not.
point | The point to be tested for containment |
|
inline |
Tests whether a point lies within the extended GenericAABB.
This test interprets the boundaries of the GenericAABB as an half-open interval. The minimal values stored in minCorner are considered to belong to the bounding box while the maximal values stored in maxCorner are not.
point | The point to be tested for containment |
dx | An epsilon the box is extended by in each direction before the test |
|
inline |
Tests whether a point lies within the GenericAABB.
This test interprets the boundaries of the GenericAABB as a closed interval. The minimal values stored in minCorner are considered to belong to the bounding box as well as the maximal values stored in maxCorner.
point | The point to be tested for containment |
|
inline |
Tests whether a point lies within the extended GenericAABB.
This test interprets the boundaries of the GenericAABB as a closed interval. The minimal values stored in minCorner are considered to belong to the bounding box as well as the maximal values stored in maxCorner.
point | The point to be tested for containment |
dx | An epsilon the box is extended by in each direction before the test |
|
inline |
Computes the eight corners of this GenericAABB.
|
static |
Builds a GenericAABB from a min- and a maxCorner.
minX | x-coordinate of the minCorner |
minY | y-coordinate of the minCorner |
minZ | z-coordinate of the minCorner |
maxX | x-coordinate of the maxCorner |
maxY | y-coordinate of the maxCorner |
maxZ | z-coordinate of the maxCorner |
|
static |
Builds a GenericAABB from a min- and a maxCorner.
theMinCorner | corner with minimal values |
theMaxCorner | corner with maximal values |
|
inline |
Computes the distance of point to this GenericAABB.
point | The point of which the distance to *this should be computed |
|
inline |
Checks whether the GenericAABB is empty.
|
inline |
Extends this GenericAABB.
eps | epsilon by which the bounding box is extended in each direction |
|
inline |
Extends this GenericAABB.
eps | epsilon vector by which the bounding box is extended. The box is extended in each direction by the corresponding vector component. |
|
inline |
Creates a new GenericAABB by extending this one.
eps | epsilon by which the bounding box is extended in each direction |
|
inline |
Creates a new GenericAABB by extending this one.
eps | epsilon vector by which the bounding box is extended. The box is extended in each direction by the corresponding vector component. |
|
inline |
Computes the intersection of this and another GenericAABB.
other | Other GenericAABB to be intersected with *this |
|
inline |
Creates a new GenericAABB by merging this one with an other GenericAABB.
other | The GenericAABB that will be covered by the resulting GenericAABB |
|
inline |
Creates a new GenericAABB by merging this one with an additional point.
Note that for the resulting GenericAABB containsClosedInterval( point ) will be true but contains( point ) may be false!
point | The point that will be covered by the resulting GenericAABB |
|
inline |
GenericAABB< T > walberla::math::GenericAABB< T >::getMerged | ( | InputIterator | first, |
InputIterator | last | ||
) | const |
Creates a new GenericAABB by merging this one to a Sequence of points or other GenericAABBs.
InputIterator | A ForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >. |
first | First element of sequence [first, last) |
last | Final element of sequence [first, last) |
|
inline |
Creates a new GenericAABB by scaling this one.
factor | Factor by which the bounding box gets scaled. |
|
inline |
Creates a new GenericAABB by scaling this one.
factors | Vector of scaling factors by which the bounding box gets scaled on the respective axises. |
|
inline |
Creates a new GenericAABB by translating this one.
translation | Vector by which the GenericAABB is translated. |
|
inline |
Reinitializes this GenericAABB with default values.
|
inline |
Reinitializes this GenericAABB from two arbitrary points.
x0 | x-coordinate of the first corner spanning the AABB |
y0 | y-coordinate of the first corner spanning the AABB |
z0 | z-coordinate of the first corner spanning the AABB |
x1 | x-coordinate of the second corner spanning the AABB |
y1 | y-coordinate of the second corner spanning the AABB |
z1 | z-coordinate of the second corner spanning the AABB |
|
inline |
Reinitializes this GenericAABB from two arbitrary points.
corner0 | first corner spanning the AABB |
corner1 | second corner spanning the AABB |
|
inline |
Reinitializes this GenericAABB by merging a Sequence of points or GenericAABBs.
InputIterator | ForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >. |
first | first element of sequence [first, last) |
last | final element of sequence [first, last) |
|
inline |
Reinitializes this GenericAABB from a min- and a maxCorner.
minX | x-coordinate of the minCorner |
minY | y-coordinate of the minCorner |
minZ | z-coordinate of the minCorner |
maxX | x-coordinate of the maxCorner |
maxY | y-coordinate of the maxCorner |
maxZ | z-coordinate of the maxCorner |
|
inline |
Reinitializes this GenericAABB from a min- and a maxCorner.
theMinCorner | corner with minimal values |
theMaxCorner | corner with maximal values |
|
inline |
Intersects this with another GenericAABB.
other | Other GenericAABB to be intersected with *this |
|
inline |
Computes the volume of the intersection of this and another GenericAABB.
other | Other GenericAABB to be intersected with *this |
|
inline |
Tests whether this genericAABB intersects another GenericAABB.
This test interprets the boundaries of the GenericAABB as an half-open interval. The minimal values stored in minCorner are considered to belong to the bounding boxes while the maximal values stored in maxCorner are not.
other | Other GenericAABB to be tested for intersection |
|
inline |
Tests whether this extended GenericAABB intersects another GenericAABB.
This test interprets the boundaries of the GenericAABB as an half-open interval. The minimal values stored in minCorner are considered to belong to the bounding boxes while the maximal values stored in maxCorner are not.
other | Other GenericAABB to be tested for intersection |
dx | An epsilon the box is extended by in each direction before the test |
|
inline |
Tests whether this genericAABB intersects another GenericAABB.
This test interprets the boundaries of the GenericAABB as a closed interval. The minimal values stored in minCorner are considered to belong to the bounding boxes as well as the maximal values stored in maxCorner.
other | Other GenericAABB to be tested for intersection |
|
inline |
Tests whether this extended GenericAABB intersects another GenericAABB.
This test interprets the boundaries of the GenericAABB as a closed interval. The minimal values stored in minCorner are considered to belong to the bounding boxes as well as the maximal values stored in maxCorner.
other | Other GenericAABB to be tested for intersection |
dx | An epsilon the box is extended by in each direction before the test |
|
inline |
Test whether this and another GenericAABB are equal.
Uses walberla::floatIsEqual method for determination of equality. Small roundoff errors are neglected in this check.
other | Other GenericAABB to be tested for equality |
|
inline |
Test whether this and another GenericAABB are exactly identical.
other | Other GenericAABB to be tested for identity |
|
inline |
|
inline |
|
inline |
Provides access to the corner with maximal values.
|
inline |
Computes the maximal distance of point to the far side of this GenericAABB.
point | The point of which the maximal distance to *this should be computed |
|
inline |
Merges this GenericAABB with an other GenericAABB.
other | The GenericAABB that will be covered by the resulting GenericAABB |
|
inline |
Merges this GenericAABB with an additional point.
Note that for the resulting GenericAABB containsClosedInterval( point ) will be true but contains( point ) may be false!
point | The point that will be covered by the resulting GenericAABB |
|
inline |
Merges this GenericAABB with a Sequence of points or other GenericAABBs.
InputIterator | A ForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >. |
first | First element of sequence [first, last) |
last | Final element of sequence [first, last) |
|
inline |
|
inline |
|
inline |
Provides access to the corner with minimal values.
|
inline |
|
inline |
Assignment operator for GenericAABBs of different value_type.
U | value_type of other GenericAABB |
other | other GenericAABB |
|
inline |
|
inline |
Scales this GenericAABB.
factor | Factor by which the bounding box gets scaled. |
|
inline |
Scales this GenericAABB.
factors | Vector of scaling factors by which the bounding box gets scaled on the respective axises. |
|
inline |
Sets the minimum and maximum for one axis.
index | 0 for x, 1 for y, 2 for z axis |
value1,value2 | the smaller of the two values is taken as minimum, the other as maximum |
|
inline |
Sets center of this GenericAABB.
AABB gets translated such that its center matches the given center.
center | new center location |
|
inline |
Computes the signed distance of point to this GenericAABB.
point | The point of which the distance to *this should be computed |
|
inline |
Provides access to one of the extends of the genericAABB.
index | Determines the axis of which the extend is given: 0 -> x, 1 -> y, 2 -> z |
|
inline |
Provides access to a vector of the genericAABBs extends.
|
inline |
Computes the distance between two GenericAABBs.
other | The other AABB to which the distance to *this should be computed |
|
inline |
Computes the squared distance of point to this GenericAABB.
point | The point of which the distance to *this should be computed |
|
inline |
Computes the maximal distance of any two points from two GenericAABBs.
other | The other AABB to which the maximal distance to *this should be computed |
|
inline |
Computes the squared maximal distance of point to the far side of this GenericAABB.
point | The point of which the maximal distance to *this should be computed |
|
inline |
Computes the squared signed distance of point to this GenericAABB.
point | The point of which the distance to *this should be computed |
|
inline |
Translates this GenericAABB.
translation | Vector by which the GenericAABB is translated. |
|
inline |
|
inline |
Provides access to the x-component of the corner with maximal values.
|
inline |
Provides access to the x-component of the corner with minimal values.
|
inline |
Provides access to the extend of the genericAABB in x direction.
|
inline |
Provides access to the y-component of the corner with maximal values.
|
inline |
Provides access to the y-component of the corner with minimal values.
|
inline |
Provides access to the extend of the genericAABB in y direction.
|
inline |
Provides access to the z-component of the corner with maximal values.
|
inline |
Provides access to the z-component of the corner with minimal values.
|
inline |
Provides access to the extend of the genericAABB in z direction.
|
friend |
Deserializes an GenericAABB from a mpi::GenericRecvBuffer.
buf | The mpi::GenericRecvBuffer written to |
aabb | The GenericAABB the be deserialized |
|
private |
minimal values
|
private |