![]() |
Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Math class that represents a sphere "S2" in a three dimensional euclidean space. More...
Public Member Functions | |
| Sphere (T X, T Y, T Z, T Radius) | |
| Constructs a Sphere object from its center position and radius. More... | |
| Sphere (const Vector3< T > ¢er, T Radius) | |
| Constructs a Sphere object from its position and radius. More... | |
| Sphere (const T sphere[4]) | |
| Constructs a Sphere object from an array of four elements. More... | |
| template<typename U > | |
| Sphere (const Sphere< U > &sphere) | |
| Constructs a Sphere object from another type of Sphere. More... | |
| Sphere (const Sphere &sphere)=default | |
| bool | Contains (T X, T Y, T Z) const |
| Tests whether the sphere contains the provided point inclusive of the edge of the sphere. More... | |
| bool | Contains (const Box< T > &box) const |
| Tests whether the sphere contains the provided box inclusive of the edge of the sphere. More... | |
| bool | Contains (const Vector3< T > &point) const |
| Tests whether the sphere contains the provided point inclusive of the edge of the sphere. More... | |
| T | Distance (T X, T Y, T Z) const |
| Returns the distance from the sphere to the point (is negative when the point is inside the sphere) More... | |
| T | Distance (const Vector3< T > &point) const |
| Returns the distance from the sphere to the point (is negative when the point is inside the sphere) More... | |
| Sphere & | ExtendTo (T X, T Y, T Z) |
| Extends the sphere to contain the point in the boundary. More... | |
| Sphere & | ExtendTo (const Vector3< T > &point) |
| Extends the sphere to contain the point in the boundary. More... | |
| Vector3< T > | GetNegativeVertex (const Vector3< T > &normal) const |
| Computes the negative vertex of one direction. More... | |
| Vector3< T > | GetPosition () const |
| Gets a Vector3 of the position. More... | |
| Vector3< T > | GetPositiveVertex (const Vector3< T > &normal) const |
| Computes the positive vertex of one direction. More... | |
| bool | Intersect (const Box< T > &box) const |
| Checks whether or not this sphere intersects a box. More... | |
| bool | Intersect (const Sphere &sphere) const |
| Checks whether or not this sphere intersects another sphere. More... | |
| bool | IsValid () const |
| Checks whether this sphere is valid. More... | |
| Sphere & | MakeUnit () |
| Makes the sphere position (0, 0, 0) and radius 1. More... | |
| Sphere & | MakeZero () |
| Makes the sphere position (0, 0, 0) and radius 0. More... | |
| Sphere & | Set (T X, T Y, T Z, T Radius) |
| Sets the components of the sphere with center and radius. More... | |
| Sphere & | Set (const Sphere &sphere) |
| Sets the components of the sphere with center and radius from another. More... | |
| Sphere & | Set (const Vector3< T > ¢er, T Radius) |
| Sets the components of the sphere with center and radius. More... | |
| Sphere & | Set (const T sphere[4]) |
| Sets the components of the sphere from an array of four elements. More... | |
| template<typename U > | |
| Sphere & | Set (const Sphere< U > &sphere) |
| String | ToString () const |
| Gives a string representation. More... | |
| T & | operator[] (std::size_t i) |
| Returns the ith element of the sphere. More... | |
| T | operator[] (std::size_t i) const |
| Returns the ith element of the sphere. More... | |
| Sphere | operator* (T scalar) const |
| Multiplies the radius of the sphere with a scalar. More... | |
| Sphere & | operator= (const Sphere &other)=default |
| Sphere & | operator*= (T scalar) |
| Multiplies the radius of other sphere with a scalar. More... | |
| bool | operator== (const Sphere &sphere) const |
| Compares the sphere to other one. More... | |
| bool | operator!= (const Sphere &sphere) const |
| Compares the sphere to other one. More... | |
| template<typename U > | |
| Sphere< T > & | Set (const Sphere< U > &sphere) |
| Sets the components of the sphere from another type of Sphere. More... | |
Static Public Member Functions | |
| static Sphere | Lerp (const Sphere &from, const Sphere &to, T interpolation) |
| Interpolates the sphere to other one with a factor of interpolation. More... | |
| static Sphere | Unit () |
| Shorthand for the sphere (0, 0, 0, 1) More... | |
| static Sphere | Zero () |
| Shorthand for the sphere (0, 0, 0, 0) More... | |
Public Attributes | |
| T | x |
| T | y |
| T | z |
| T | radius |
Math class that represents a sphere "S2" in a three dimensional euclidean space.
| Nz::Sphere< T >::Sphere | ( | T | X, |
| T | Y, | ||
| T | Z, | ||
| T | Radius | ||
| ) |
Constructs a Sphere object from its center position and radius.
| X | X position |
| Y | Y position |
| Z | Z position |
| Radius | half of the diameter |
| Nz::Sphere< T >::Sphere | ( | const Vector3< T > & | center, |
| T | Radius | ||
| ) |
Constructs a Sphere object from its position and radius.
| center | Center of the sphere |
| Radius | Half of the diameter |
| Nz::Sphere< T >::Sphere | ( | const T | sphere[4] | ) |
Constructs a Sphere object from an array of four elements.
| sphere[4] | sphere[0] is X component, sphere[1] is Y component, sphere[2] is Z component and sphere[3] is radius |
|
explicit |
| bool Nz::Sphere< T >::Contains | ( | T | X, |
| T | Y, | ||
| T | Z | ||
| ) | const |
Tests whether the sphere contains the provided point inclusive of the edge of the sphere.
| X | X position of the point |
| Y | Y position of the point |
| Z | Z position of the point |
| bool Nz::Sphere< T >::Contains | ( | const Box< T > & | box | ) | const |
Tests whether the sphere contains the provided box inclusive of the edge of the sphere.
| box | Three dimensional box |
| bool Nz::Sphere< T >::Contains | ( | const Vector3< T > & | point | ) | const |
Tests whether the sphere contains the provided point inclusive of the edge of the sphere.
| point | Position of the point |
| T Nz::Sphere< T >::Distance | ( | T | X, |
| T | Y, | ||
| T | Z | ||
| ) | const |
Returns the distance from the sphere to the point (is negative when the point is inside the sphere)
| X | X position of the point |
| Y | Y position of the point |
| Z | Z position of the point |
| T Nz::Sphere< T >::Distance | ( | const Vector3< T > & | point | ) | const |
Returns the distance from the sphere to the point (is negative when the point is inside the sphere)
| point | Position of the point |
| Sphere< T > & Nz::Sphere< T >::ExtendTo | ( | T | X, |
| T | Y, | ||
| T | Z | ||
| ) |
Extends the sphere 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 |
| Sphere< T > & Nz::Sphere< T >::ExtendTo | ( | const Vector3< T > & | point | ) |
Extends the sphere to contain the point in the boundary.
| point | Position of the point |
| Vector3< T > Nz::Sphere< T >::GetNegativeVertex | ( | const Vector3< T > & | normal | ) | const |
Computes the negative vertex of one direction.
| normal | Vector normalized indicating a direction |
| Vector3< T > Nz::Sphere< T >::GetPosition | ( | ) | const |
Gets a Vector3 of the position.
| Vector3< T > Nz::Sphere< T >::GetPositiveVertex | ( | const Vector3< T > & | normal | ) | const |
Computes the positive vertex of one direction.
| normal | Vector normalized indicating a direction |
| bool Nz::Sphere< T >::Intersect | ( | const Box< T > & | box | ) | const |
Checks whether or not this sphere intersects a box.
| box | Box to check |
| bool Nz::Sphere< T >::Intersect | ( | const Sphere< T > & | sphere | ) | const |
Checks whether or not this sphere intersects another sphere.
| sphere | Sphere to check |
| bool Nz::Sphere< T >::IsValid | ( | ) | const |
Checks whether this sphere is valid.
|
static |
Interpolates the sphere to other one with a factor of interpolation.
| from | Initial sphere |
| to | Target sphere |
| interpolation | Factor of interpolation |
| Sphere< T > & Nz::Sphere< T >::MakeUnit | ( | ) |
Makes the sphere position (0, 0, 0) and radius 1.
| Sphere< T > & Nz::Sphere< T >::MakeZero | ( | ) |
Makes the sphere position (0, 0, 0) and radius 0.
| bool Nz::Sphere< T >::operator!= | ( | const Sphere< T > & | sphere | ) | const |
Compares the sphere to other one.
| sphere | Other sphere to compare with |
| Sphere< T > Nz::Sphere< T >::operator* | ( | T | scalar | ) | const |
Multiplies the radius of the sphere with a scalar.
| scale | The scalar to multiply radius with |
| Sphere< T > & Nz::Sphere< T >::operator*= | ( | T | scalar | ) |
Multiplies the radius of other sphere with a scalar.
| scale | The scalar to multiply radius with |
| bool Nz::Sphere< T >::operator== | ( | const Sphere< T > & | sphere | ) | const |
Compares the sphere to other one.
| sphere | Other sphere to compare with |
| T & Nz::Sphere< T >::operator[] | ( | std::size_t | i | ) |
Returns the ith element of the sphere.
| std::domain_error | if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4 |
| T Nz::Sphere< T >::operator[] | ( | std::size_t | i | ) | const |
Returns the ith element of the sphere.
| std::domain_error | if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4 |
| Sphere< T > & Nz::Sphere< T >::Set | ( | T | X, |
| T | Y, | ||
| T | Z, | ||
| T | Radius | ||
| ) |
Sets the components of the sphere with center and radius.
| X | X position |
| Y | Y position |
| Z | Z position |
| Radius | half of the diameter |
| Sphere< T > & Nz::Sphere< T >::Set | ( | const Sphere< T > & | sphere | ) |
Sets the components of the sphere with center and radius from another.
| sphere | The other sphere |
| Sphere< T > & Nz::Sphere< T >::Set | ( | const Vector3< T > & | center, |
| T | Radius | ||
| ) |
Sets the components of the sphere with center and radius.
| center | Center of the sphere |
| Radius | Half of the diameter |
| Sphere< T > & Nz::Sphere< T >::Set | ( | const T | sphere[4] | ) |
Sets the components of the sphere from an array of four elements.
| sphere[4] | sphere[0] is X position, sphere[1] is Y position, sphere[2] is Z position and sphere[3] is radius |
| Sphere<T>& Nz::Sphere< T >::Set | ( | const Sphere< U > & | sphere | ) |
| String Nz::Sphere< T >::ToString | ( | ) | const |
Gives a string representation.
|
static |
Shorthand for the sphere (0, 0, 0, 1)
|
static |
Shorthand for the sphere (0, 0, 0, 0)