Murl::Math::Ray< DataType > Class Template Reference

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]

template<class DataType >
Murl::Math::Ray< DataType >::Ray ( )
inline

The default constructor.

This creates a ray starting at (0/0/0) and pointing towards the positive Z axis.

◆ Ray() [2/3]

template<class DataType >
Murl::Math::Ray< DataType >::Ray ( const Vector< DataType > &  origin,
const Vector< DataType > &  direction 
)
inline

Constructor taking origin and direction vectors.

Parameters
originThe ray origin.
directionThe ray direction.

◆ Ray() [3/3]

template<class DataType >
template<class DataType2 >
Murl::Math::Ray< DataType >::Ray ( const Ray< DataType2 > &  other)
inline

The copy constructor using a ray of different type.

Parameters
otherThe ray to copy.

Member Function Documentation

◆ Set() [1/2]

template<class DataType >
void Murl::Math::Ray< DataType >::Set ( const Ray< DataType > &  other)
inline

Copy the content of a source ray to the ray instance.

Parameters
otherThe ray to copy from.

References Murl::Math::Ray< DataType >::mDirection, and Murl::Math::Ray< DataType >::mOrigin.

◆ Set() [2/2]

template<class DataType >
void Murl::Math::Ray< DataType >::Set ( const Vector< DataType > &  origin,
const Vector< DataType > &  direction 
)
inline

Set a ray from given origin and direction vectors.

Parameters
originThe ray origin.
directionThe ray direction.

References Murl::Math::Ray< DataType >::mDirection, and Murl::Math::Ray< DataType >::mOrigin.

◆ SetOrigin()

template<class DataType >
void Murl::Math::Ray< DataType >::SetOrigin ( const Vector< DataType > &  origin)
inline

Set the ray origin.

Parameters
originThe ray origin.

References Murl::Math::Ray< DataType >::mOrigin.

◆ GetOrigin()

template<class DataType >
const Vector<DataType>& Murl::Math::Ray< DataType >::GetOrigin ( ) const
inline

Get the ray origin.

Returns
The ray origin.

References Murl::Math::Ray< DataType >::mOrigin.

◆ SetDirection()

template<class DataType >
void Murl::Math::Ray< DataType >::SetDirection ( const Vector< DataType > &  direction)
inline

Set the ray direction.

Parameters
directionThe ray direction.

References Murl::Math::Ray< DataType >::mDirection.

◆ GetDirection()

template<class DataType >
const Vector<DataType>& Murl::Math::Ray< DataType >::GetDirection ( ) const
inline

Get the ray direction.

Returns
The ray direction.

References Murl::Math::Ray< DataType >::mDirection.

◆ IsIntersecting() [1/2]

template<class DataType >
Bool Murl::Math::Ray< DataType >::IsIntersecting ( const Sphere< DataType > &  sphere,
DataType *  lambda = nullptr 
) const
inline

Check if the ray is intersecting a given sphere.

Parameters
sphereThe sphere to check.
lambdaAn 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]

template<class DataType >
Bool Murl::Math::Ray< DataType >::IsIntersecting ( const Box< DataType > &  box,
DataType *  lambda = nullptr 
) const
inline

Check if the ray is intersecting a given box.

Parameters
boxThe box to check.
lambdaAn 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


Copyright © 2011-2024 Spraylight GmbH.