|
CeresEngine 0.2.0
A game development framework
|
Axis aligned box represented by minimum and maximum point. More...
#include <CeresEngine/Math/Geometry.hpp>
Public Types | |
| enum | Corner { FarLeftBottom = 0 , FarLeftTop = 1 , FarRightTop = 2 , FarRightBottom = 3 , NearRightBottom = 7 , NearLeftBottom = 6 , NearLeftTop = 5 , NearRightTop = 4 } |
| Different corners of a box. More... | |
Public Member Functions | |
| TAABox ()=default | |
| TAABox (const TVector3< T > &min, const TVector3< T > &max) | |
| TAABox (const TSphere< T > &sphere) | |
| TAABox (const TAABox &)=default | |
| ~TAABox ()=default | |
| TAABox | scale (const TVector3< T > &s) const |
| Scales the box around the center by multiplying its extents with the provided scale. | |
| TAABox | translate (const TVector3< T > &t) const |
Translates the box center by adding t to the minimum and maximum. | |
| TVector3< T > | getCorner (Corner cornerToGet) const noexcept |
| Returns the coordinates of a specific corner. | |
| Array< TVector3< T >, 8 > | getCorners () const noexcept |
| TAABox | merge (const TAABox &rhs) |
| Merges the two boxes, creating a new bounding box that encapsulates them both. | |
| TAABox | merge (const TVector3< T > &point) |
| Expands the bounding box so it includes the provided point. | |
| void | transform (const TMatrix4< T > &matrix) |
| Transforms the bounding box by the given matrix. | |
| void | transform (const TTransform< T > &aTransform) |
| Transforms the bounding box by the given matrix. | |
| bool | intersects (const TAABox &b2) const |
| Returns true if this and the provided box intersect. | |
| bool | intersects (const TSphere< T > &s) const |
| Returns true if the sphere intersects the bounding box. | |
| bool | intersects (const TPlane< T > &p) const |
| Returns true if the plane intersects the bounding box. | |
| TRayIntersection< T > | intersects (const TRay< T > &ray) const |
| Ray / box intersection, returns a boolean result and nearest distance to intersection. | |
| bool | intersects (const TRay< T > &ray, T &d1, T &d2) const |
| Ray / box intersection, returns boolean result and near and far intersection distance. | |
| bool | contains (const TVector3< T > &v) const |
| Returns true if the provided point is inside the bounding box. | |
| bool | contains (const TVector3< T > &v, T extra) const |
| Returns true if the provided point is inside the bounding box while. | |
| bool | contains (const TAABox &other) const |
| Returns true if the provided bounding box is completely inside the bounding box. | |
| bool | contains (const TSphere< T > &s) const |
| Returns true if the sphere is completely inside the bounding box. | |
| TVector3< T > | getCenter () const |
| Center of the box. | |
| TVector3< T > | getSize () const |
| Size of the box (difference between minimum and maximum corners) | |
| TVector3< T > | getHalfSize () const |
| Extents of the box (distance from center to one of the corners) | |
| T | getRadius () const |
| Radius of a sphere that fully encompasses the box. | |
| T | getVolume () const |
| Size of the volume in the box. | |
Public Attributes | |
| TVector3< T > | minimum = Vector3(-T(0.5), -T(0.5), -T(0.5)) |
| The corner of the box with minimum values (opposite to maximum corner). | |
| TVector3< T > | maximum = Vector3(T(0.5), T(0.5), T(0.5)) |
| The corner of the box with maximum values (opposite to minimum corner). | |
Static Public Attributes | |
| static const TAABox | empty |
| static const TAABox | unit |
| static const TAABox | infinity |
| template<typename I = UInt32> | |
| static constexpr I | CUBE_INDICES [] |
| Indices that can be used for rendering a box constructed from 8 corner vertices, using AABox::Corner for mapping. | |
Friends | |
| bool | operator== (const TAABox &lhs, const TAABox &rhs) |
| bool | operator!= (const TAABox &lhs, const TAABox &rhs) |
| TAABox | operator+ (const TAABox &lhs, const TAABox &rhs) |
| Merges the two boxes, creating a new bounding box that encapsulates them both. | |
| TAABox & | operator+= (TAABox &lhs, const TAABox &rhs) |
| Merges the two boxes, creating a new bounding box that encapsulates them both. | |
| TAABox | operator+ (const TAABox &lhs, const TVector3< T > &rhs) |
| Expands the bounding box so it includes the provided point. | |
| TAABox & | operator+= (TAABox &lhs, const TVector3< T > &rhs) |
| Expands the bounding box so it includes the provided point. | |
| TAABox | operator* (const TMatrix4< T > &lhs, TAABox rhs) |
| Transforms the bounding box by the given matrix. | |
| TAABox | operator* (const TTransform< T > &lhs, TAABox rhs) |
| Transforms the bounding box by the given transform. | |
Axis aligned box represented by minimum and maximum point.
| enum Math::TAABox::Corner |
|
default |
| Math::TAABox< T >::TAABox | ( | const TVector3< T > & | min, |
| const TVector3< T > & | max | ||
| ) |
|
inlineexplicit |
|
default |
|
default |
| bool Math::TAABox< T >::contains | ( | const TAABox< T > & | other | ) | const |
Returns true if the provided bounding box is completely inside the bounding box.
| bool Math::TAABox< T >::contains | ( | const TSphere< T > & | s | ) | const |
Returns true if the sphere is completely inside the bounding box.
| bool Math::TAABox< T >::contains | ( | const TVector3< T > & | v | ) | const |
Returns true if the provided point is inside the bounding box.
| bool Math::TAABox< T >::contains | ( | const TVector3< T > & | v, |
| T | extra | ||
| ) | const |
Returns true if the provided point is inside the bounding box while.
expanding the bounds by extra in every direction.
| TVector3< T > Math::TAABox< T >::getCenter | ( | ) | const |
Center of the box.
|
noexcept |
Returns the coordinates of a specific corner.
|
noexcept |
| TVector3< T > Math::TAABox< T >::getHalfSize | ( | ) | const |
Extents of the box (distance from center to one of the corners)
| T Math::TAABox< T >::getRadius | ( | ) | const |
Radius of a sphere that fully encompasses the box.
| TVector3< T > Math::TAABox< T >::getSize | ( | ) | const |
Size of the box (difference between minimum and maximum corners)
| T Math::TAABox< T >::getVolume | ( | ) | const |
Size of the volume in the box.
| bool Math::TAABox< T >::intersects | ( | const TAABox< T > & | b2 | ) | const |
Returns true if this and the provided box intersect.
| bool Math::TAABox< T >::intersects | ( | const TPlane< T > & | p | ) | const |
Returns true if the plane intersects the bounding box.
| TRayIntersection< T > Math::TAABox< T >::intersects | ( | const TRay< T > & | ray | ) | const |
Ray / box intersection, returns a boolean result and nearest distance to intersection.
| bool Math::TAABox< T >::intersects | ( | const TRay< T > & | ray, |
| T & | d1, | ||
| T & | d2 | ||
| ) | const |
Ray / box intersection, returns boolean result and near and far intersection distance.
| bool Math::TAABox< T >::intersects | ( | const TSphere< T > & | s | ) | const |
Returns true if the sphere intersects the bounding box.
| TAABox Math::TAABox< T >::merge | ( | const TAABox< T > & | rhs | ) |
Merges the two boxes, creating a new bounding box that encapsulates them both.
| TAABox Math::TAABox< T >::merge | ( | const TVector3< T > & | point | ) |
Expands the bounding box so it includes the provided point.
| TAABox Math::TAABox< T >::scale | ( | const TVector3< T > & | s | ) | const |
Scales the box around the center by multiplying its extents with the provided scale.
| void Math::TAABox< T >::transform | ( | const TMatrix4< T > & | matrix | ) |
Transforms the bounding box by the given matrix.
|
inline |
Transforms the bounding box by the given matrix.
| TAABox Math::TAABox< T >::translate | ( | const TVector3< T > & | t | ) | const |
Translates the box center by adding t to the minimum and maximum.
Transforms the bounding box by the given matrix.
|
friend |
Transforms the bounding box by the given transform.
Merges the two boxes, creating a new bounding box that encapsulates them both.
| lhs | The box to be expanded |
| rhs | The box to expand with |
|
friend |
Expands the bounding box so it includes the provided point.
| lhs | The box to be expanded |
| rhs | The point to be encapsulated |
Merges the two boxes, creating a new bounding box that encapsulates them both.
| lhs | The box to be expanded |
| rhs | The box to expand with |
lhs Expands the bounding box so it includes the provided point.
| lhs | The box to be expanded |
| rhs | The point to be encapsulated |
lhs
|
inlinestaticconstexpr |
Indices that can be used for rendering a box constructed from 8 corner vertices, using AABox::Corner for mapping.
| I | the index type |
|
static |
|
static |
| TVector3<T> Math::TAABox< T >::maximum = Vector3(T(0.5), T(0.5), T(0.5)) |
The corner of the box with maximum values (opposite to minimum corner).
| TVector3<T> Math::TAABox< T >::minimum = Vector3(-T(0.5), -T(0.5), -T(0.5)) |
The corner of the box with minimum values (opposite to maximum corner).
|
static |