walberla::math::GenericAABB< T > Class Template Reference

Detailed Description

template<typename T>
class walberla::math::GenericAABB< T >

GenericAABB represents an axis-aligned bounding box.

Template Parameters
TThe data type used to store the minimal and maximal corner points. May be float, double or long double.
Invariant
minCorner.x <= maxCorner.x && minCorner.y <= maxCorner.y && minCorner.z <= maxCorner.z

#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 >
GenericAABBoperator= (const GenericAABB< U > &other)
 
const vector_typeminCorner () const
 Provides access to the corner with minimal values. More...
 
const vector_typemaxCorner () const
 Provides access to the corner with maximal values. More...
 
const vector_typemin () const
 
const vector_typemax () 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 &center)
 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...
 

Member Typedef Documentation

◆ value_type

template<typename T >
using walberla::math::GenericAABB< T >::value_type = T

◆ vector_type

template<typename T >
using walberla::math::GenericAABB< T >::vector_type = Vector3<T>

scalar data type

Constructor & Destructor Documentation

◆ GenericAABB() [1/8]

template<typename T >
walberla::math::GenericAABB< T >::GenericAABB
inline

data type for three dimensional vectors

Builds a default GenericAABB.

Postcondition
minCorner = maxCorner = (0,0,0)

◆ GenericAABB() [2/8]

template<typename T >
template<typename U >
walberla::math::GenericAABB< T >::GenericAABB ( const GenericAABB< U > &  other)
inline

Copy constructor for GenericAABBs of different value_type.

Template Parameters
Uvalue_type of other GenericAABB
Parameters
otherother GenericAABB

◆ GenericAABB() [3/8]

template<typename T >
walberla::math::GenericAABB< T >::GenericAABB ( const vector_type corner0,
const vector_type corner1 
)
inline

Builds a GenericAABB from two arbitrary points.

Parameters
corner0first corner spanning the AABB
corner1second corner spanning the AABB

◆ GenericAABB() [4/8]

template<typename T >
walberla::math::GenericAABB< T >::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 
)
inline

Builds a GenericAABB from two arbitrary points given with their coordinates.

Parameters
x0x-coordinate of the first corner spanning the AABB
y0y-coordinate of the first corner spanning the AABB
z0z-coordinate of the first corner spanning the AABB
x1x-coordinate of the second corner spanning the AABB
y1y-coordinate of the second corner spanning the AABB
z1z-coordinate of the second corner spanning the AABB

◆ GenericAABB() [5/8]

template<typename T >
template<typename InputIterator >
walberla::math::GenericAABB< T >::GenericAABB ( InputIterator  first,
InputIterator  last 
)
inline

Builds a default GenericAABB by merging a Sequence of points or GenericAABBs.

Template Parameters
InputIteratorForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >.
Parameters
firstfirst element of sequence [first, last)
lastfinal element of sequence [first, last)
Postcondition
first == last => minCorner = maxCorner = (0,0,0)

◆ GenericAABB() [6/8]

template<typename T >
walberla::math::GenericAABB< T >::GenericAABB ( const vector_type theMinCorner,
const vector_type theMaxCorner,
MinMaxCornerGivenT   
)
inlineprotected

Helper type to distinguish ctors with equal signature.

Builds a GenericAABB from a min- and a maxCorner.

Parameters
theMinCornercorner with minimal values
theMaxCornercorner with maximal values
Precondition
theMinCorner.x <= theMaxCorner.x && theMinCorner.y <= theMaxCorner.y && theMinCorner.z <= theMaxCorner.z

◆ GenericAABB() [7/8]

template<typename T >
walberla::math::GenericAABB< T >::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   
)
inlineprotected

Builds a GenericAABB from a min- and a maxCorner.

Parameters
minXx-coordinate of the minCorner
minYy-coordinate of the minCorner
minZz-coordinate of the minCorner
maxXx-coordinate of the maxCorner
maxYy-coordinate of the maxCorner
maxZz-coordinate of the maxCorner
Precondition
x0 <= x1 && y0 <= y1 && z0 <= z1

◆ GenericAABB() [8/8]

template<typename T >
walberla::math::GenericAABB< T >::GenericAABB ( const GenericAABB< T > &  lhs,
const GenericAABB< T > &  rhs 
)
inlineprotected

Builds a GenericAABB as an intersection of two other GenericAABBs.

Parameters
lhsan arbitrary GenericAABB
rhsan arbitrary GenericAABB
Postcondition
lhs does not intersect rhs => minCorner = maxCorner )

Member Function Documentation

◆ center()

template<typename T >
GenericAABB< T >::vector_type walberla::math::GenericAABB< T >::center
inline

Calculates the center of the genericAABB.

Returns
The calculated center

◆ checkInvariant()

template<typename T >
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

Returns
true if the invariant is satisfied, false else

◆ contains() [1/6]

template<typename T >
bool walberla::math::GenericAABB< T >::contains ( const GenericAABB< T > &  other) const
inline

Tests whether an other GenericAABB lies within the GenericAABB.

Parameters
otherAn other GenericAABB
Returns
if other lies in the GenericAABB true, else false

◆ contains() [2/6]

template<typename T >
bool walberla::math::GenericAABB< T >::contains ( const GenericAABB< T > &  other,
const value_type  dx 
) const
inline

Tests whether an other GenericAABB lies within the extended GenericAABB.

Parameters
otherAn other GenericAABB
dxAn epsilon the box is extended by in each direction before the test
Returns
if other lies in the extended GenericAABB true, else false

◆ contains() [3/6]

template<typename T >
bool walberla::math::GenericAABB< T >::contains ( const value_type  x,
const value_type  y,
const value_type  z 
) const
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.

Parameters
xx coordinate of the point to be tested for containment
yy coordinate of the point to be tested for containment
zz coordinate of the point to be tested for containment
Returns
if point lies in the GenericAABB true, else false

◆ contains() [4/6]

template<typename T >
bool walberla::math::GenericAABB< T >::contains ( const value_type  x,
const value_type  y,
const value_type  z,
const value_type  dx 
) const
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.

Parameters
xx coordinate of the point to be tested for containment
yy coordinate of the point to be tested for containment
zz coordinate of the point to be tested for containment
dxAn epsilon the box is extended by in each direction before the test
Returns
if point lies in the extended GenericAABB true, else false

◆ contains() [5/6]

template<typename T >
bool walberla::math::GenericAABB< T >::contains ( const vector_type point) const
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.

Parameters
pointThe point to be tested for containment
Returns
if point lies in the GenericAABB true, else false

◆ contains() [6/6]

template<typename T >
bool walberla::math::GenericAABB< T >::contains ( const vector_type point,
const value_type  dx 
) const
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.

Parameters
pointThe point to be tested for containment
dxAn epsilon the box is extended by in each direction before the test
Returns
if point lies in the extended GenericAABB true, else false

◆ containsClosedInterval() [1/2]

template<typename T >
bool walberla::math::GenericAABB< T >::containsClosedInterval ( const vector_type point) const
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.

Parameters
pointThe point to be tested for containment
Returns
if point lies in the GenericAABB true, else false

◆ containsClosedInterval() [2/2]

template<typename T >
bool walberla::math::GenericAABB< T >::containsClosedInterval ( const vector_type point,
const value_type  dx 
) const
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.

Parameters
pointThe point to be tested for containment
dxAn epsilon the box is extended by in each direction before the test
Returns
if point lies in the extended GenericAABB true, else false

◆ corners()

template<typename T >
std::array< typename GenericAABB< T >::vector_type, 8 > walberla::math::GenericAABB< T >::corners
inline

Computes the eight corners of this GenericAABB.

Returns
An array of size eight containing the corner points. Indices match those of the stencil::D3CornerStencil

◆ createFromMinMaxCorner() [1/2]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::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 
)
static

Builds a GenericAABB from a min- and a maxCorner.

Parameters
minXx-coordinate of the minCorner
minYy-coordinate of the minCorner
minZz-coordinate of the minCorner
maxXx-coordinate of the maxCorner
maxYy-coordinate of the maxCorner
maxZz-coordinate of the maxCorner
Precondition
x0 <= x1 && y0 <= y1 && z0 <= z1

◆ createFromMinMaxCorner() [2/2]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::createFromMinMaxCorner ( const vector_type theMinCorner,
const vector_type theMaxCorner 
)
static

Builds a GenericAABB from a min- and a maxCorner.

Parameters
theMinCornercorner with minimal values
theMaxCornercorner with maximal values
Precondition
minCorner.x <= maxCorner.x && minCorner.y <= maxCorner.y && minCorner.z <= maxCorner.z

◆ distance()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::distance ( const vector_type point) const
inline

Computes the distance of point to this GenericAABB.

Parameters
pointThe point of which the distance to *this should be computed
Returns
0, if point lies inside or on the surface of *this
The (positive) distance of point to the surface of *this, if point lies outside of *this

◆ empty()

template<typename T >
bool walberla::math::GenericAABB< T >::empty
inline

Checks whether the GenericAABB is empty.

Returns
true, if the GenericAABB is empty(), false else

◆ extend() [1/2]

template<typename T >
void walberla::math::GenericAABB< T >::extend ( const value_type  eps)
inline

Extends this GenericAABB.

Parameters
epsepsilon by which the bounding box is extended in each direction

◆ extend() [2/2]

template<typename T >
void walberla::math::GenericAABB< T >::extend ( const vector_type eps)
inline

Extends this GenericAABB.

Parameters
epsepsilon vector by which the bounding box is extended. The box is extended in each direction by the corresponding vector component.

◆ getExtended() [1/2]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getExtended ( const value_type  eps) const
inline

Creates a new GenericAABB by extending this one.

Parameters
epsepsilon by which the bounding box is extended in each direction
Returns
The extended GenericAABB

◆ getExtended() [2/2]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getExtended ( const vector_type eps) const
inline

Creates a new GenericAABB by extending this one.

Parameters
epsepsilon vector by which the bounding box is extended. The box is extended in each direction by the corresponding vector component.
Returns
The extended GenericAABB

◆ getIntersection()

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getIntersection ( const GenericAABB< T > &  other) const
inline

Computes the intersection of this and another GenericAABB.

Parameters
otherOther GenericAABB to be intersected with *this
Returns
The intersection of *this and other

◆ getMerged() [1/4]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getMerged ( const GenericAABB< T > &  other) const
inline

Creates a new GenericAABB by merging this one with an other GenericAABB.

Parameters
otherThe GenericAABB that will be covered by the resulting GenericAABB
Returns
A GenericAABB covering other
Postcondition
contains( other )

◆ getMerged() [2/4]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getMerged ( const vector_type point) const
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!

Parameters
pointThe point that will be covered by the resulting GenericAABB
Returns
A GenericAABB covering point
Postcondition
containsClosedInterval( point )

◆ getMerged() [3/4]

template<typename T >
template<typename InputIterator >
GenericAABB walberla::math::GenericAABB< T >::getMerged ( InputIterator  first,
InputIterator  last 
) const
inline

◆ getMerged() [4/4]

template<typename T >
template<typename InputIterator >
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.

Template Parameters
InputIteratorA ForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >.
Parameters
firstFirst element of sequence [first, last)
lastFinal element of sequence [first, last)
Returns
A GenericAABB covering *this and all the Points/GenericAABBs in the sequence

◆ getScaled() [1/2]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getScaled ( const value_type  factor) const
inline

Creates a new GenericAABB by scaling this one.

Parameters
factorFactor by which the bounding box gets scaled.
Returns
The scaled GenericAABB

◆ getScaled() [2/2]

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getScaled ( const vector_type factors) const
inline

Creates a new GenericAABB by scaling this one.

Parameters
factorsVector of scaling factors by which the bounding box gets scaled on the respective axises.
Returns
The scaled GenericAABB

◆ getTranslated()

template<typename T >
GenericAABB< T > walberla::math::GenericAABB< T >::getTranslated ( const vector_type translation) const
inline

Creates a new GenericAABB by translating this one.

Parameters
translationVector by which the GenericAABB is translated.
Returns
The translated GenericAABB

◆ init() [1/4]

template<typename T >
void walberla::math::GenericAABB< T >::init
inline

Reinitializes this GenericAABB with default values.

Postcondition
minCorner = maxCorner = (0,0,0)

◆ init() [2/4]

template<typename T >
void walberla::math::GenericAABB< T >::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 
)
inline

Reinitializes this GenericAABB from two arbitrary points.

Parameters
x0x-coordinate of the first corner spanning the AABB
y0y-coordinate of the first corner spanning the AABB
z0z-coordinate of the first corner spanning the AABB
x1x-coordinate of the second corner spanning the AABB
y1y-coordinate of the second corner spanning the AABB
z1z-coordinate of the second corner spanning the AABB

◆ init() [3/4]

template<typename T >
void walberla::math::GenericAABB< T >::init ( const vector_type corner0,
const vector_type corner1 
)
inline

Reinitializes this GenericAABB from two arbitrary points.

Parameters
corner0first corner spanning the AABB
corner1second corner spanning the AABB

◆ init() [4/4]

template<typename T >
template<typename InputIterator >
void walberla::math::GenericAABB< T >::init ( InputIterator  first,
InputIterator  last 
)
inline

Reinitializes this GenericAABB by merging a Sequence of points or GenericAABBs.

Template Parameters
InputIteratorForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >.
Parameters
firstfirst element of sequence [first, last)
lastfinal element of sequence [first, last)
Postcondition
first == last => minCorner = maxCorner = (0,0,0)

◆ initMinMaxCorner() [1/2]

template<typename T >
void walberla::math::GenericAABB< T >::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 
)
inline

Reinitializes this GenericAABB from a min- and a maxCorner.

Parameters
minXx-coordinate of the minCorner
minYy-coordinate of the minCorner
minZz-coordinate of the minCorner
maxXx-coordinate of the maxCorner
maxYy-coordinate of the maxCorner
maxZz-coordinate of the maxCorner
Precondition
minX <= maxX && minY <= maxY && minZ <= maxZ

◆ initMinMaxCorner() [2/2]

template<typename T >
void walberla::math::GenericAABB< T >::initMinMaxCorner ( const vector_type theMinCorner,
const vector_type theMaxCorner 
)
inline

Reinitializes this GenericAABB from a min- and a maxCorner.

Parameters
theMinCornercorner with minimal values
theMaxCornercorner with maximal values
Precondition
theMinCorner.x <= theMaxCorner.x && theMinCorner.y <= theMaxCorner.y && theMinCorner.z <= theMaxCorner.z

◆ intersect()

template<typename T >
void walberla::math::GenericAABB< T >::intersect ( const GenericAABB< T > &  other)
inline

Intersects this with another GenericAABB.

Parameters
otherOther GenericAABB to be intersected with *this

◆ intersectionVolume()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::intersectionVolume ( const GenericAABB< T > &  other) const
inline

Computes the volume of the intersection of this and another GenericAABB.

Parameters
otherOther GenericAABB to be intersected with *this
Returns
The volume of *this intersected with other

◆ intersects() [1/2]

template<typename T >
bool walberla::math::GenericAABB< T >::intersects ( const GenericAABB< T > &  other) const
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.

Parameters
otherOther GenericAABB to be tested for intersection
Returns
true, if *this intersects other, false else

◆ intersects() [2/2]

template<typename T >
bool walberla::math::GenericAABB< T >::intersects ( const GenericAABB< T > &  other,
const value_type  dx 
) const
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.

Parameters
otherOther GenericAABB to be tested for intersection
dxAn epsilon the box is extended by in each direction before the test
Returns
true, if *this extended by dx intersects other, false else

◆ intersectsClosedInterval() [1/2]

template<typename T >
bool walberla::math::GenericAABB< T >::intersectsClosedInterval ( const GenericAABB< T > &  other) const
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.

Parameters
otherOther GenericAABB to be tested for intersection
Returns
true, if *this intersects other, false else

◆ intersectsClosedInterval() [2/2]

template<typename T >
bool walberla::math::GenericAABB< T >::intersectsClosedInterval ( const GenericAABB< T > &  other,
const value_type  dx 
) const
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.

Parameters
otherOther GenericAABB to be tested for intersection
dxAn epsilon the box is extended by in each direction before the test
Returns
true, if *this extended by dx intersects other, false else

◆ isEqual()

template<typename T >
bool walberla::math::GenericAABB< T >::isEqual ( const GenericAABB< T > &  other) const
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.

Parameters
otherOther GenericAABB to be tested for equality
Returns
true, if *this is equal to other, false else

◆ isIdentical()

template<typename T >
bool walberla::math::GenericAABB< T >::isIdentical ( const GenericAABB< T > &  other) const
inline

Test whether this and another GenericAABB are exactly identical.

Parameters
otherOther GenericAABB to be tested for identity
Returns
true, if *this is exactly identical to other, false else

◆ max() [1/2]

template<typename T >
const vector_type& walberla::math::GenericAABB< T >::max ( ) const
inline

◆ max() [2/2]

template<typename T >
value_type walberla::math::GenericAABB< T >::max ( const uint_t  index) const
inline

◆ maxCorner()

template<typename T >
const GenericAABB< T >::vector_type & walberla::math::GenericAABB< T >::maxCorner
inline

Provides access to the corner with maximal values.

Returns
the corner with maximal values

◆ maxDistance()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::maxDistance ( const vector_type point) const
inline

Computes the maximal distance of point to the far side of this GenericAABB.

Parameters
pointThe point of which the maximal distance to *this should be computed
Returns
The maximal (positive) distance of point to the surface of *this.

◆ merge() [1/3]

template<typename T >
void walberla::math::GenericAABB< T >::merge ( const GenericAABB< T > &  other)
inline

Merges this GenericAABB with an other GenericAABB.

Parameters
otherThe GenericAABB that will be covered by the resulting GenericAABB
Postcondition
contains( other )

◆ merge() [2/3]

template<typename T >
void walberla::math::GenericAABB< T >::merge ( const vector_type point)
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!

Parameters
pointThe point that will be covered by the resulting GenericAABB
Postcondition
containsClosedInterval( point )

◆ merge() [3/3]

template<typename T >
template<typename InputIterator >
void walberla::math::GenericAABB< T >::merge ( InputIterator  first,
InputIterator  last 
)
inline

Merges this GenericAABB with a Sequence of points or other GenericAABBs.

Template Parameters
InputIteratorA ForwardIterator. Must dereference to Vector3< T > or GenericAABB< T >.
Parameters
firstFirst element of sequence [first, last)
lastFinal element of sequence [first, last)

◆ min() [1/2]

template<typename T >
const vector_type& walberla::math::GenericAABB< T >::min ( ) const
inline

◆ min() [2/2]

template<typename T >
value_type walberla::math::GenericAABB< T >::min ( const uint_t  index) const
inline

◆ minCorner()

template<typename T >
const GenericAABB< T >::vector_type & walberla::math::GenericAABB< T >::minCorner
inline

Provides access to the corner with minimal values.

Returns
the corner with minimal values

◆ operator=() [1/2]

template<typename T >
template<typename U >
GenericAABB& walberla::math::GenericAABB< T >::operator= ( const GenericAABB< U > &  other)
inline

◆ operator=() [2/2]

template<typename T >
template<typename U >
GenericAABB< T >& walberla::math::GenericAABB< T >::operator= ( const GenericAABB< U > &  other)
inline

Assignment operator for GenericAABBs of different value_type.

Template Parameters
Uvalue_type of other GenericAABB
Parameters
otherother GenericAABB

◆ randomPoint()

template<typename T >
template<typename Engine >
GenericAABB< T >::vector_type walberla::math::GenericAABB< T >::randomPoint ( Engine &  engine) const
inline

Generates a random point uniformly distributed within the AABB.

The point is in ( [ xMin(), xMax() ), [ yMin(), yMax() ), [ zMin(), zMax() ) )

Precondition
!empty()
Parameters
engineAn Uniform Random Number Generator (e.g. std::mt19937)
Returns
Random point within *this

◆ scale() [1/2]

template<typename T >
void walberla::math::GenericAABB< T >::scale ( const value_type  factor)
inline

Scales this GenericAABB.

Parameters
factorFactor by which the bounding box gets scaled.

◆ scale() [2/2]

template<typename T >
void walberla::math::GenericAABB< T >::scale ( const vector_type factors)
inline

Scales this GenericAABB.

Parameters
factorsVector of scaling factors by which the bounding box gets scaled on the respective axises.

◆ setAxisBounds()

template<typename T >
void walberla::math::GenericAABB< T >::setAxisBounds ( const uint_t  index,
const value_type  value1,
const value_type  value2 
)
inline

Sets the minimum and maximum for one axis.

Parameters
index0 for x, 1 for y, 2 for z axis
value1,value2the smaller of the two values is taken as minimum, the other as maximum

◆ setCenter()

template<typename T >
void walberla::math::GenericAABB< T >::setCenter ( const vector_type center)
inline

Sets center of this GenericAABB.

AABB gets translated such that its center matches the given center.

Parameters
centernew center location

◆ signedDistance()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::signedDistance ( const vector_type point) const
inline

Computes the signed distance of point to this GenericAABB.

Parameters
pointThe point of which the distance to *this should be computed
Returns
The negative distance of point to the surface of *this, if point lies inside of *this
0, if point lies on the surface of *this
The positive distance of point to the surface of *this, if point lies outside of *this

◆ size()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::size ( const uint_t  index) const
inline

Provides access to one of the extends of the genericAABB.

Parameters
indexDetermines the axis of which the extend is given: 0 -> x, 1 -> y, 2 -> z
Returns
The extend of the GenericAABB on the requested axis

◆ sizes()

template<typename T >
GenericAABB< T >::vector_type walberla::math::GenericAABB< T >::sizes
inline

Provides access to a vector of the genericAABBs extends.

Returns
A vector with the GenericAABBs extends in x-, y-, and z-Direction

◆ sqDistance() [1/2]

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::sqDistance ( const GenericAABB< T > &  other) const
inline

Computes the distance between two GenericAABBs.

Parameters
otherThe other AABB to which the distance to *this should be computed
Returns
The (positive) distance of the surface of other to the surface of *this. 0 if *this and other are intersecting.

◆ sqDistance() [2/2]

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::sqDistance ( const vector_type point) const
inline

Computes the squared distance of point to this GenericAABB.

Parameters
pointThe point of which the distance to *this should be computed
Returns
0, if point lies inside or on the surface of *this
The squared (positive) distance of point to the surface of *this, if point lies outside of *this

◆ sqMaxDistance() [1/2]

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::sqMaxDistance ( const GenericAABB< T > &  other) const
inline

Computes the maximal distance of any two points from two GenericAABBs.

Parameters
otherThe other AABB to which the maximal distance to *this should be computed
Returns
The maximal (positive) distance of any point in other to any point in this.

◆ sqMaxDistance() [2/2]

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::sqMaxDistance ( const vector_type point) const
inline

Computes the squared maximal distance of point to the far side of this GenericAABB.

Parameters
pointThe point of which the maximal distance to *this should be computed
Returns
The maximal squared (positive) distance of point to the surface of *this.

◆ sqSignedDistance()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::sqSignedDistance ( const vector_type point) const
inline

Computes the squared signed distance of point to this GenericAABB.

Parameters
pointThe point of which the distance to *this should be computed
Returns
The negative squared distance of point to the surface of *this, if point lies inside of *this
0, if point lies on the surface of *this
The positive squared distance of point to the surface of *this, if point lies outside of *this

◆ translate()

template<typename T >
void walberla::math::GenericAABB< T >::translate ( const vector_type translation)
inline

Translates this GenericAABB.

Parameters
translationVector by which the GenericAABB is translated.

◆ volume()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::volume
inline

Calculates the volume of the genericAABB.

Returns
The calculated volume
Invariant
empty() => 0

◆ xMax()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::xMax
inline

Provides access to the x-component of the corner with maximal values.

Returns
the x-component of the corner with maximal values

◆ xMin()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::xMin
inline

Provides access to the x-component of the corner with minimal values.

Returns
the x-component of the corner with minimal values

◆ xSize()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::xSize
inline

Provides access to the extend of the genericAABB in x direction.

Returns
The extend of the GenericAABB on the x axis

◆ yMax()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::yMax
inline

Provides access to the y-component of the corner with maximal values.

Returns
the y-component of the corner with maximal values

◆ yMin()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::yMin
inline

Provides access to the y-component of the corner with minimal values.

Returns
the y-component of the corner with minimal values

◆ ySize()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::ySize
inline

Provides access to the extend of the genericAABB in y direction.

Returns
The extend of the GenericAABB on the y axis

◆ zMax()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::zMax
inline

Provides access to the z-component of the corner with maximal values.

Returns
the z-component of the corner with maximal values

◆ zMin()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::zMin
inline

Provides access to the z-component of the corner with minimal values.

Returns
the z-component of the corner with minimal values

◆ zSize()

template<typename T >
GenericAABB< T >::value_type walberla::math::GenericAABB< T >::zSize
inline

Provides access to the extend of the genericAABB in z direction.

Returns
The extend of the GenericAABB on the z axis

Friends And Related Function Documentation

◆ operator>>

template<typename T >
template<typename ET >
mpi::GenericRecvBuffer< ET >& operator>> ( mpi::GenericRecvBuffer< ET > &  buf,
GenericAABB< T > &  aabb 
)
friend

Deserializes an GenericAABB from a mpi::GenericRecvBuffer.

Parameters
bufThe mpi::GenericRecvBuffer written to
aabbThe GenericAABB the be deserialized
Returns
A reference to buf

Member Data Documentation

◆ maxCorner_

template<typename T >
vector_type walberla::math::GenericAABB< T >::maxCorner_
private

minimal values

◆ minCorner_

template<typename T >
vector_type walberla::math::GenericAABB< T >::minCorner_
private

The documentation for this class was generated from the following files: