Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Math class that represents a three dimensional box. More...
Public Member Functions | |
Box (T Width, T Height, T Depth) | |
Constructs a Box object from its width, height and depth. More... | |
Box (T X, T Y, T Z, T Width, T Height, T Depth) | |
Constructs a Rect<T> object from its position, width, height and depth. More... | |
Box (const T box[6]) | |
Constructs a Box object from an array of six elements. More... | |
Box (const Rect< T > &rect) | |
Constructs a Box object from a Rect. More... | |
Box (const Vector3< T > &lengths) | |
Constructs a Box object from a vector representing width, height and depth. More... | |
Box (const Vector3< T > &vec1, const Vector3< T > &vec2) | |
Constructs a Box object from two vectors representing point of the space (X, Y, Z) will be the components minimum of the two vectors and the (width, height, depth) will be the components maximum - minimum. More... | |
template<typename U > | |
Box (const Box< U > &box) | |
Constructs a Box object from another type of Box. More... | |
Box (const Box &box)=default | |
bool | Contains (T X, T Y, T Z) const |
Tests whether the box contains the provided point inclusive of the edge of the box. More... | |
bool | Contains (const Box &box) const |
Tests whether the box contains the provided box inclusive of the edge of the box. More... | |
bool | Contains (const Vector3< T > &point) const |
Tests whether the box contains the provided point inclusive of the edge of the box. More... | |
Box & | ExtendTo (T X, T Y, T Z) |
Extends the box to contain the point in the boundary. More... | |
Box & | ExtendTo (const Box &box) |
Extends the box to contain the box. More... | |
Box & | ExtendTo (const Vector3< T > &point) |
Extends the box to contain the point in the boundary. More... | |
Sphere< T > | GetBoundingSphere () const |
Gets the bounding sphere for the box. More... | |
Vector3< T > | GetCenter () const |
Gets a Vector3 for the center. More... | |
Vector3< T > | GetCorner (BoxCorner corner) const |
Gets the Vector3 for the corner. More... | |
Vector3< T > | GetLengths () const |
Gets a Vector3 for the lengths. More... | |
Vector3< T > | GetMaximum () const |
Gets a Vector3 for the maximum point. More... | |
Vector3< T > | GetMinimum () const |
Gets a Vector3 for the minimum point. More... | |
Vector3< T > | GetNegativeVertex (const Vector3< T > &normal) const |
Computes the negative vertex of one direction. More... | |
Vector3< T > | GetPosition () const |
Gets a Vector3 for the position. More... | |
Vector3< T > | GetPositiveVertex (const Vector3< T > &normal) const |
Computes the positive vertex of one direction. More... | |
T | GetRadius () const |
Gets the radius of the box. More... | |
Sphere< T > | GetSquaredBoundingSphere () const |
Gets the squared bounding sphere for the box. More... | |
T | GetSquaredRadius () const |
Gets the squared radius of the box. More... | |
bool | Intersect (const Box &box, Box *intersection=nullptr) const |
Checks whether or not this box intersects another one. More... | |
bool | IsValid () const |
Checks whether this box is valid. More... | |
Box & | MakeZero () |
Makes the box position (0, 0, 0) and lengths (0, 0, 0) More... | |
Box & | Set (T Width, T Height, T Depth) |
Sets the components of the box with width, height and depth. More... | |
Box & | Set (T X, T Y, T Z, T Width, T Height, T Depth) |
Constructs a Box object from its position and sizes. More... | |
Box & | Set (const T box[6]) |
Sets the components of the box from an array of six elements. More... | |
Box & | Set (const Box &box) |
Sets the components of the box with components from another. More... | |
Box & | Set (const Rect< T > &rect) |
Sets the components of the box with components from a Rect. More... | |
Box & | Set (const Vector3< T > &lengths) |
Sets the components of the box from a vector representing width, height and depth. More... | |
Box & | Set (const Vector3< T > &vec1, const Vector3< T > &vec2) |
Sets the components of the box from two vectors representing point of the space (X, Y, Z) will be the components minimum of the two vectors and the (width, height, depth) will be the components maximum - minimum. More... | |
template<typename U > | |
Box & | Set (const Box< U > &box) |
String | ToString () const |
Gives a string representation. More... | |
Box & | Transform (const Matrix4< T > &matrix, bool applyTranslation=true) |
Transforms the box according to the matrix. More... | |
Box & | Translate (const Vector3< T > &translation) |
Translates the box. More... | |
T & | operator[] (std::size_t i) |
Returns the ith element of the box. More... | |
T | operator[] (std::size_t i) const |
Returns the ith element of the box. More... | |
Box | operator* (T scalar) const |
Multiplies the lengths with the scalar. More... | |
Box | operator* (const Vector3< T > &vec) const |
Multiplies the lengths with the vector. More... | |
Box & | operator= (const Box &other)=default |
Box & | operator*= (T scalar) |
Multiplies the lengths of this box with the scalar. More... | |
Box & | operator*= (const Vector3< T > &vec) |
Multiplies the lengths of this box with the vector. More... | |
bool | operator== (const Box &box) const |
Compares the box to other one. More... | |
bool | operator!= (const Box &box) const |
Compares the box to other one. More... | |
template<typename U > | |
Box< T > & | Set (const Box< U > &box) |
Sets the components of the box from another type of Box. More... | |
Static Public Member Functions | |
static Box | Lerp (const Box &from, const Box &to, T interpolation) |
Interpolates the box to other one with a factor of interpolation. More... | |
static Box | Zero () |
Shorthand for the box (0, 0, 0, 0, 0, 0) More... | |
Public Attributes | |
T | x |
T | y |
T | z |
T | width |
T | height |
T | depth |
Math class that represents a three dimensional box.
Constructs a Box object from its width, height and depth.
Width | Width of the box (following X) |
Height | Height of the box (following Y) |
Depth | Depth of the box (following Z) |
Constructs a Rect<T> object from its position, width, height and depth.
X | X position |
Y | Y position |
Z | Z position |
Width | Width of the box (following X) |
Height | Height of the box (following Y) |
Depth | Depth of the box (following Z) |
Constructs a Box object from an array of six elements.
vec[6] | vec[0] is X position, vec[1] is Y position, vec[2] is Z position, vec[3] is width, vec[4] is height and vec[5] is depth |
Constructs a Box object from a vector representing width, height and depth.
lengths | (Width, Height, Depth) of the box |
Constructs a Box object from two vectors representing point of the space (X, Y, Z) will be the components minimum of the two vectors and the (width, height, depth) will be the components maximum - minimum.
vec1 | First point |
vec2 | Second point |
bool Nz::Box< T >::Contains | ( | T | X, |
T | Y, | ||
T | Z | ||
) | const |
Tests whether the box contains the provided point inclusive of the edge of the box.
X | X position of the point |
Y | Y position of the point |
Z | Z position of the point |
Tests whether the box contains the provided box inclusive of the edge of the box.
box | Other box to test |
Tests whether the box contains the provided point inclusive of the edge of the box.
point | Position of the point |
Extends the box to contain the point in the boundary.
X | X position of the point |
Y | Y position of the point |
Z | Z position of the point |
Extends the box to contain the box.
box | Other box to contain |
Extends the box to contain the point in the boundary.
point | Position of the point |
Gets the bounding sphere for the box.
Gets a Vector3 for the center.
Gets a Vector3 for the lengths.
Gets a Vector3 for the minimum point.
Vector3< T > Nz::Box< T >::GetNegativeVertex | ( | const Vector3< T > & | normal | ) | const |
Computes the negative vertex of one direction.
normal | Vector indicating a direction |
Gets a Vector3 for the position.
Vector3< T > Nz::Box< T >::GetPositiveVertex | ( | const Vector3< T > & | normal | ) | const |
Computes the positive vertex of one direction.
normal | Vector indicating a direction |
T Nz::Box< T >::GetRadius | ( | ) | const |
Gets the radius of the box.
Gets the squared bounding sphere for the box.
T Nz::Box< T >::GetSquaredRadius | ( | ) | const |
Gets the squared radius of the box.
bool Nz::Box< T >::Intersect | ( | const Box< T > & | box, |
Box< T > * | intersection = nullptr |
||
) | const |
Checks whether or not this box intersects another one.
box | Box to check |
intersection | Optional argument for the box which represent the intersection |
bool Nz::Box< T >::IsValid | ( | ) | const |
Checks whether this box is valid.
|
static |
Interpolates the box to other one with a factor of interpolation.
from | Initial box |
to | Target box |
interpolation | Factor of interpolation |
Makes the box position (0, 0, 0) and lengths (0, 0, 0)
Compares the box to other one.
box | Other box to compare with |
Multiplies the lengths with the scalar.
scalar | The scalar to multiply width, height and depth with |
Multiplies the lengths with the vector.
vec | The vector where component one multiply width, two height and three depth |
Multiplies the lengths of this box with the scalar.
scalar | The scalar to multiply width, height and depth with |
Multiplies the lengths of this box with the vector.
vec | The vector where component one multiply width, two height and three depth |
Compares the box to other one.
box | Other box to compare with |
T & Nz::Box< T >::operator[] | ( | std::size_t | i | ) |
Returns the ith element of the box.
std::domain_error | if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6 |
T Nz::Box< T >::operator[] | ( | std::size_t | i | ) | const |
Returns the ith element of the box.
std::domain_error | if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6 |
Sets the components of the box with width, height and depth.
Width | Width of the box (following X) |
Height | Height of the box (following Y) |
Depth | Depth of the box (following Z) |
Constructs a Box object from its position and sizes.
X | X component of position |
Y | Y component of position |
Z | Z component of position |
Width | Width of the box (following X) |
Height | Height of the box (following Y) |
Depth | Depth of the box (following Z) |
Sets the components of the box from an array of six elements.
box[6] | box[0] is X position, box[1] is Y position, box[2] is Z position, box[3] is width, box[4] is height and box[5] is depth |
Sets the components of the box with components from another.
box | The other box |
Sets the components of the box with components from a Rect.
rect | Rectangle which describes (X, Y) position and (width, height) lenghts |
Sets the components of the box from a vector representing width, height and depth.
lengths | (Width, Height, depth) of the box |
Box< T > & Nz::Box< T >::Set | ( | const Vector3< T > & | vec1, |
const Vector3< T > & | vec2 | ||
) |
Sets the components of the box from two vectors representing point of the space (X, Y, Z) will be the components minimum of the two vectors and the (width, height, depth) will be the components maximum - minimum.
vec1 | First point |
vec2 | Second point |
Gives a string representation.
Box< T > & Nz::Box< T >::Transform | ( | const Matrix4< T > & | matrix, |
bool | applyTranslation = true |
||
) |
Transforms the box according to the matrix.
matrix | Matrix4 representing the transformation |
applyTranslation | Should transform the position or the direction |
Translates the box.
translation | Vector3 which is the translation for the position |
Shorthand for the box (0, 0, 0, 0, 0, 0)