|
CeresEngine 0.2.0
A game development framework
|
A ray in 3D space represented with an origin and direction. More...
#include <CeresEngine/Math/Geometry.hpp>
Public Member Functions | |
| constexpr | TRay ()=default |
| Creates a new default ray. | |
| constexpr | TRay (const TVector3< T > &origin, const TVector3< T > &direction) |
Creates a new ray that starts from the given origin and moves in the given direction. | |
| constexpr TVector3< T > | getPoint (T t) const |
| Gets the position of a point t units along the ray. | |
| void | transform (const TMatrix4< T > &matrix) |
| Transforms the ray by the given matrix. | |
| void | transform (const TTransform< T > &aTransform) |
| Transforms the ray by the given matrix. | |
| TRayIntersection< T > | intersects (const TPlane< T > &p) const |
| Ray/plane intersection, returns boolean result and distance to intersection point. | |
| TRayIntersection< T > | intersects (const TSphere< T > &s) const |
| Ray/sphere intersection, returns boolean result and distance to nearest intersection point. | |
| TRayIntersection< T > | intersects (const TAABox< T > &box) const |
| Ray/axis aligned box intersection, returns boolean result and distance to nearest intersection point. | |
| TRayIntersection< T > | intersects (const TVector3< T > &a, const TVector3< T > &b, const TVector3< T > &c, const TVector3< T > &normal, bool positiveSide=true, bool negativeSide=true) const |
| Ray/triangle intersection, returns boolean result and distance to intersection point. | |
| constexpr TVector3< T > | operator[] (T t) const |
| Gets the position of a point t units along the ray. | |
Public Attributes | |
| TVector3< T > | origin = TVector3<T>(T(0.0)) |
| The ray origin position. | |
| TVector3< T > | direction = TVector3<T>(T(0.0), T(0.0), T(1.0)) |
| The ray direction vector. | |
Friends | |
| TRay< T > | operator* (const TMatrix4< T > &lhs, TRay< T > rhs) |
| Transforms the ray by the given matrix. | |
| TRay< T > | operator* (const TTransform< T > &lhs, TRay< T > rhs) |
| Transforms the ray by the given transform. | |
A ray in 3D space represented with an origin and direction.
|
constexprdefault |
Creates a new default ray.
|
inlineconstexpr |
Creates a new ray that starts from the given origin and moves in the given direction.
| origin | The ray origin position |
| direction | The ray direction vector |
|
inlineconstexpr |
Gets the position of a point t units along the ray.
| TRayIntersection< T > Math::TRay< T >::intersects | ( | const TAABox< T > & | box | ) | const |
Ray/axis aligned box intersection, returns boolean result and distance to nearest intersection point.
| TRayIntersection< T > Math::TRay< T >::intersects | ( | const TPlane< T > & | p | ) | const |
Ray/plane intersection, returns boolean result and distance to intersection point.
| TRayIntersection< T > Math::TRay< T >::intersects | ( | const TSphere< T > & | s | ) | const |
Ray/sphere intersection, returns boolean result and distance to nearest intersection point.
| TRayIntersection< T > Math::TRay< T >::intersects | ( | const TVector3< T > & | a, |
| const TVector3< T > & | b, | ||
| const TVector3< T > & | c, | ||
| const TVector3< T > & | normal, | ||
| bool | positiveSide = true, |
||
| bool | negativeSide = true |
||
| ) | const |
Ray/triangle intersection, returns boolean result and distance to intersection point.
| a | Triangle first vertex. |
| b | Triangle second vertex. |
| c | Triangle third vertex. |
| normal | The normal of the triangle. Doesn't need to be normalized. |
| positiveSide | Should intersections with the positive side (the normal facing) count. |
| negativeSide | Should intersections with the negative side (the opposite of normal facing) count. |
|
inlineconstexpr |
Gets the position of a point t units along the ray.
| void Math::TRay< T >::transform | ( | const TMatrix4< T > & | matrix | ) |
Transforms the ray by the given matrix.
|
inline |
Transforms the ray by the given matrix.
Transforms the ray by the given matrix.
| lhs | The transformation to be applied |
| rhs | The ray to apply the transformation for |
|
friend |
Transforms the ray by the given transform.
| lhs | The transformation to be applied |
| rhs | The ray to apply the transformation for |
| TVector3<T> Math::TRay< T >::direction = TVector3<T>(T(0.0), T(0.0), T(1.0)) |
The ray direction vector.
| TVector3<T> Math::TRay< T >::origin = TVector3<T>(T(0.0)) |
The ray origin position.