#include <AABB.h>
Public Member Functions | |
MCORE_INLINE | AABB () |
MCORE_INLINE | AABB (const AZ::Vector3 &minPnt, const AZ::Vector3 &maxPnt) |
MCORE_INLINE void | Init () |
MCORE_INLINE bool | CheckIfIsValid () const |
MCORE_INLINE void | Encapsulate (const AZ::Vector3 &v) |
MCORE_INLINE void | Encapsulate (const AABB &box) |
MCORE_INLINE void | Widen (float delta) |
MCORE_INLINE void | Translate (const AZ::Vector3 &offset) |
MCORE_INLINE bool | Contains (const AZ::Vector3 &v) const |
MCORE_INLINE bool | Contains (const AABB &box) const |
MCORE_INLINE bool | Intersects (const AABB &box) const |
MCORE_INLINE float | CalcWidth () const |
MCORE_INLINE float | CalcHeight () const |
MCORE_INLINE float | CalcDepth () const |
MCORE_INLINE float | CalcVolume () const |
MCORE_INLINE float | CalcSurfaceArea () const |
MCORE_INLINE AZ::Vector3 | CalcMiddle () const |
MCORE_INLINE AZ::Vector3 | CalcExtents () const |
MCORE_INLINE float | CalcRadius () const |
MCORE_INLINE const AZ::Vector3 & | GetMin () const |
MCORE_INLINE const AZ::Vector3 & | GetMax () const |
MCORE_INLINE void | SetMin (const AZ::Vector3 &minVec) |
MCORE_INLINE void | SetMax (const AZ::Vector3 &maxVec) |
void | CalcCornerPoints (AZ::Vector3 *outPoints) const |
An axis aligned bounding box (AABB). This box is constructed out of two 3D points, a minimum and a maximum. This means the box does not rotate, but always keeps aligned each axis. Usage for this template could be for building a bounding volume around any given 3D object and use it to accelerate ray tracing or visibility tests.
|
inline |
Default constructor. Initializes the min and max point to the extremes. This means it's basically inside out at infinite size. So you are ready to start encapsulating points.
|
inline |
Constructor which inits the minimum and maximum point of the box.
minPnt | The minimum point. |
maxPnt | The maximum point. |
|
inline |
Calculates and returns the depth of the box. The depth is the distance between the minimum and maximum point, along the Y-axis.
|
inline |
Calculates the extents of the box. This is the vector from the center to a corner of the box.
|
inline |
Calculates and returns the height of the box. The height is the distance between the minimum and maximum point, along the Z-axis.
|
inline |
Calculates the center/middle of the box. This is simply done by taking the average of the minimum and maximum point along each axis.
|
inline |
Calculates the radius of this box. With radius we mean the length of the vector from the center of the box to the minimum or maximum point. So if you would construct a sphere with as center the middle of this box and with a radius returned by this method, you will get the minimum sphere which exactly contains this box.
|
inline |
Calculate the surface area of the box.
|
inline |
Calculate the volume of the box. This equals width x height x depth.
|
inline |
Calculates and returns the width of the box. The width is the distance between the minimum and maximum point, along the X-axis.
|
inline |
|
inline |
Checks if a given AABB is COMPLETELY inside this box or not. Note that the edges/planes of this box are counted as 'inside'.
box | The AABB to perform the test with. |
|
inline |
Checks if a given point is inside this box or not. Note that the edges/planes of the box are also counted as 'inside'.
v | The vector (3D point) to perform the test with. |
|
inline |
MCORE_INLINE void MCore::AABB::Encapsulate | ( | const AZ::Vector3 & | v | ) |
Encapsulate a point in the box. This means that the box will automatically calculate the new minimum and maximum points when needed.
v | The vector (3D point) to 'add' to the box. |
|
inline |
Get the maximum point of the box.
|
inline |
Get the minimum point of the box.
|
inline |
Initialize the box minimum and maximum points. Sets the points to floating point maximum and minimum. After calling this method you are ready to encapsulate points in it. Note, that the default constructor already calls this method. So you should only call it when you want to 'reset' the minimum and maximum points of the box.
|
inline |
|
inline |
Set the maximum point of the box.
maxVec | The vector representing the maximum point of the box. |
|
inline |
Set the minimum point of the box.
minVec | The vector representing the minimum point of the box. |
|
inline |
Translates the box with a given offset vector. This means the middle of the box will be moved by the given vector.
offset | The offset vector to translate (move) the box with. |
|
inline |
Widen the box in all dimensions with a given number of units.
delta | The delta size in units to enlarge the box with. The delta value will be added to the maximum point as well as subtracted from the minimum point. |