|
CeresEngine 0.2.0
A game development framework
|
A sphere represented by a center point and a radius. More...
#include <CeresEngine/Math/Geometry.hpp>
Public Member Functions | |
| TSphere ()=default | |
| Default constructor. Creates a unit sphere around the origin. | |
| TSphere (const TVector3< T > ¢er, T radius) | |
| TSphere (const TAABox< T > &box) | |
| void | merge (const TSphere &rhs) |
| Merges the two spheres, creating a new sphere that encapsulates them both. | |
| void | merge (const TVector3< T > &point) |
| Expands the sphere so it includes the provided point. | |
| void | transform (const TMatrix4< T > &matrix) |
| Transforms the sphere by the given matrix. | |
| void | transform (const TTransform< T > &aTransform) |
| Transforms the sphere by the given matrix. | |
| bool | contains (const TVector3< T > &v) const |
| Returns whether or not this sphere contains the provided point. | |
| bool | contains (const TAABox< T > &box) const |
| Returns whether or not this sphere contains the provided box. | |
| bool | intersects (const TSphere &s) const |
| Returns whether or not this sphere intersects another sphere. | |
| bool | intersects (const TAABox< T > &box) const |
| Returns whether or not this sphere intersects a box. | |
| bool | intersects (const TPlane< T > &plane) const |
| Returns whether or not this sphere intersects a plane. | |
| TRayIntersection< T > | intersects (const TRay< T > &ray, bool discardInside=true) const |
| Ray/sphere intersection, returns boolean result and distance to nearest intersection. | |
| T | distance (const TVector3< T > &point) const |
Calculates the minimum distance between the sphere and the given point. | |
| T | distance (const TSphere< T > &sphere) const |
| Calculates the minimum distance between two spheres. | |
Public Attributes | |
| T | radius = T(1.0) |
| The radius of the sphere. | |
| TVector3< T > | center = TVector3<T>(T(0.0)) |
| The center point of the sphere. | |
Static Public Attributes | |
| static const TSphere | empty |
| static const TSphere | unit |
| static const TSphere | infinity |
Friends | |
| TSphere | operator+ (TSphere lhs, const TSphere &rhs) |
| Merges the two spheres, creating a new sphere that encapsulates them both. | |
| TSphere & | operator+= (TSphere &lhs, const TSphere &rhs) |
| Merges the two spheres, creating a new sphere that encapsulates them both. | |
| TSphere | operator+ (TSphere lhs, const TVector3< T > &rhs) |
| Expands the sphere so it includes the provided point. | |
| TSphere & | operator+= (TSphere &lhs, const TVector3< T > &rhs) |
| Expands the sphere so it includes the provided point. | |
| TSphere | operator* (const TMatrix4< T > &lhs, TSphere rhs) |
| Transforms the sphere by the given matrix. | |
| TSphere | operator* (const TTransform< T > &lhs, TSphere rhs) |
| Transforms the sphere by the given matrix. | |
A sphere represented by a center point and a radius.
|
default |
Default constructor. Creates a unit sphere around the origin.
|
inline |
|
inlineexplicit |
| bool Math::TSphere< T >::contains | ( | const TAABox< T > & | box | ) | const |
Returns whether or not this sphere contains the provided box.
| bool Math::TSphere< T >::contains | ( | const TVector3< T > & | v | ) | const |
Returns whether or not this sphere contains the provided point.
| T Math::TSphere< T >::distance | ( | const TSphere< T > & | sphere | ) | const |
Calculates the minimum distance between two spheres.
| T Math::TSphere< T >::distance | ( | const TVector3< T > & | point | ) | const |
Calculates the minimum distance between the sphere and the given point.
| bool Math::TSphere< T >::intersects | ( | const TAABox< T > & | box | ) | const |
Returns whether or not this sphere intersects a box.
| bool Math::TSphere< T >::intersects | ( | const TPlane< T > & | plane | ) | const |
Returns whether or not this sphere intersects a plane.
| TRayIntersection< T > Math::TSphere< T >::intersects | ( | const TRay< T > & | ray, |
| bool | discardInside = true |
||
| ) | const |
Ray/sphere intersection, returns boolean result and distance to nearest intersection.
| ray | Ray to intersect with the sphere. |
| discardInside | If true the intersection will be discarded if ray origin is located within the sphere. |
| bool Math::TSphere< T >::intersects | ( | const TSphere< T > & | s | ) | const |
Returns whether or not this sphere intersects another sphere.
| void Math::TSphere< T >::merge | ( | const TSphere< T > & | rhs | ) |
Merges the two spheres, creating a new sphere that encapsulates them both.
| void Math::TSphere< T >::merge | ( | const TVector3< T > & | point | ) |
Expands the sphere so it includes the provided point.
| void Math::TSphere< T >::transform | ( | const TMatrix4< T > & | matrix | ) |
Transforms the sphere by the given matrix.
|
inline |
Transforms the sphere by the given matrix.
Transforms the sphere by the given matrix.
|
friend |
Transforms the sphere by the given matrix.
Merges the two spheres, creating a new sphere that encapsulates them both.
Expands the sphere so it includes the provided point.
Merges the two spheres, creating a new sphere that encapsulates them both.
Expands the sphere so it includes the provided point.
| TVector3<T> Math::TSphere< T >::center = TVector3<T>(T(0.0)) |
The center point of the sphere.
|
static |
|
static |
| T Math::TSphere< T >::radius = T(1.0) |
The radius of the sphere.
|
static |