cgv
Loading...
Searching...
No Matches
cgv::math::ray< T > Struct Template Reference

Struct template for varying n-dimensional rays with arbitrary data type defined by origin and direction. More...

#include <ray.h>

Public Member Functions

 ray (unsigned int n=3)
 Construct an invalid ray with origin at zero and undefined direction.
 
 ray (const vec< T > &origin, const vec< T > &direction)
 Construct a ray with given origin and direction. The given orign and direction must have the same dimension.
 
vec< T > position (T t) const
 Return the position of the ray at the given distance (ray parameter t) from its origin.
 

Public Attributes

vec< T > origin
 
vec< T > direction
 

Detailed Description

template<class T>
struct cgv::math::ray< T >

Struct template for varying n-dimensional rays with arbitrary data type defined by origin and direction.

Definition at line 11 of file ray.h.

Constructor & Destructor Documentation

◆ ray() [1/2]

template<class T >
cgv::math::ray< T >::ray ( unsigned int  n = 3)
inline

Construct an invalid ray with origin at zero and undefined direction.

Definition at line 16 of file ray.h.

References cgv::math::vec< T >::fill(), and cgv::math::vec< T >::resize().

◆ ray() [2/2]

template<class T >
cgv::math::ray< T >::ray ( const vec< T > &  origin,
const vec< T > &  direction 
)
inline

Construct a ray with given origin and direction. The given orign and direction must have the same dimension.

Definition at line 24 of file ray.h.

References cgv::math::vec< T >::dim().

Member Function Documentation

◆ position()

template<class T >
vec< T > cgv::math::ray< T >::position ( t) const
inline

Return the position of the ray at the given distance (ray parameter t) from its origin.

Definition at line 29 of file ray.h.

Member Data Documentation

◆ direction

template<class T >
vec<T> cgv::math::ray< T >::direction

Definition at line 13 of file ray.h.

◆ origin

template<class T >
vec<T> cgv::math::ray< T >::origin

Definition at line 12 of file ray.h.


The documentation for this struct was generated from the following file: