A ray class. More...
#include "murl_math_ray.h"
Public Types | |
using | ValueType = DataType |
The template parameter value type. | |
Public Member Functions | |
Ray () | |
The default constructor. More... | |
Ray (const Vector< DataType > &origin, const Vector< DataType > &direction) | |
Constructor taking origin and direction vectors. More... | |
template<class DataType2 > | |
Ray (const Ray< DataType2 > &other) | |
The copy constructor using a ray of different type. More... | |
void | Set (const Ray &other) |
Copy the content of a source ray to the ray instance. More... | |
void | Set (const Vector< DataType > &origin, const Vector< DataType > &direction) |
Set a ray from given origin and direction vectors. More... | |
void | SetOrigin (const Vector< DataType > &origin) |
Set the ray origin. More... | |
const Vector< DataType > & | GetOrigin () const |
Get the ray origin. More... | |
void | SetDirection (const Vector< DataType > &direction) |
Set the ray direction. More... | |
const Vector< DataType > & | GetDirection () const |
Get the ray direction. More... | |
Bool | IsIntersecting (const Sphere< DataType > &sphere, DataType *lambda=nullptr) const |
Check if the ray is intersecting a given sphere. More... | |
Bool | IsIntersecting (const Box< DataType > &box, DataType *lambda=nullptr) const |
Check if the ray is intersecting a given box. More... | |
Protected Attributes | |
Vector< DataType > | mOrigin |
The origin of the ray. | |
Vector< DataType > | mDirection |
The direction of the ray. | |
Detailed Description
template<class DataType>
class Murl::Math::Ray< DataType >
A ray class.
Constructor & Destructor Documentation
◆ Ray() [1/3]
|
inline |
The default constructor.
This creates a ray starting at (0/0/0) and pointing towards the positive Z axis.
◆ Ray() [2/3]
|
inline |
Constructor taking origin and direction vectors.
- Parameters
-
origin The ray origin. direction The ray direction.
◆ Ray() [3/3]
|
inline |
The copy constructor using a ray of different type.
- Parameters
-
other The ray to copy.
Member Function Documentation
◆ Set() [1/2]
|
inline |
Copy the content of a source ray to the ray instance.
- Parameters
-
other The ray to copy from.
References Murl::Math::Ray< DataType >::mDirection, and Murl::Math::Ray< DataType >::mOrigin.
◆ Set() [2/2]
|
inline |
Set a ray from given origin and direction vectors.
- Parameters
-
origin The ray origin. direction The ray direction.
References Murl::Math::Ray< DataType >::mDirection, and Murl::Math::Ray< DataType >::mOrigin.
◆ SetOrigin()
|
inline |
Set the ray origin.
- Parameters
-
origin The ray origin.
References Murl::Math::Ray< DataType >::mOrigin.
◆ GetOrigin()
|
inline |
◆ SetDirection()
|
inline |
Set the ray direction.
- Parameters
-
direction The ray direction.
References Murl::Math::Ray< DataType >::mDirection.
◆ GetDirection()
|
inline |
Get the ray direction.
- Returns
- The ray direction.
References Murl::Math::Ray< DataType >::mDirection.
◆ IsIntersecting() [1/2]
|
inline |
Check if the ray is intersecting a given sphere.
- Parameters
-
sphere The sphere to check. lambda An optional pointer to a variable receiving the lambda value of the intersection, i.e. the distance between the intersection point and the ray origin along the ray direction.
- Returns
- true if the ray is intersecting the sphere.
◆ IsIntersecting() [2/2]
|
inline |
Check if the ray is intersecting a given box.
- Parameters
-
box The box to check. lambda An optional pointer to a variable receiving the lambda value of the intersection, i.e. the distance between the intersection point and the ray origin along the ray direction.
- Returns
- true if the ray is intersecting the box.
The documentation for this class was generated from the following files:
- murl_graph_types.h
- murl_math_ray.h