cgv
Loading...
Searching...
No Matches
cgv::math::ray< T, 3 > Class Template Reference

Partial specialization of ray class for 3 dimensions. More...

#include <ray.h>

Public Member Functions

 ray ()
 Construct an invalid ray with origin at zero and undefined direction.
 
 ray (const fvec< T, 3 > &origin, const fvec< T, 3 > &direction)
 Construct a ray with given origin and direction.
 
 ray (const fvec< T, 2 > &screen_coord, const fvec< unsigned, 2 > &viewport_size, const fvec< T, 3 > &eye_position, const fmat< T, 4, 4 > &view_projection_matrix)
 Construct a ray from a given screen coordinate and view parameters.
 
fvec< T, 3 > position (float t) const
 Returns the position of the ray at the given distance (ray parameter t) from its origin.
 

Public Attributes

fvec< T, 3 > origin
 
fvec< T, 3 > direction
 

Detailed Description

template<typename T>
class cgv::math::ray< T, 3 >

Partial specialization of ray class for 3 dimensions.

Definition at line 39 of file ray.h.

Constructor & Destructor Documentation

◆ ray() [1/3]

template<typename T >
cgv::math::ray< T, 3 >::ray ( )
inline

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

Definition at line 45 of file ray.h.

◆ ray() [2/3]

template<typename T >
cgv::math::ray< T, 3 >::ray ( const fvec< T, 3 > &  origin,
const fvec< T, 3 > &  direction 
)
inline

Construct a ray with given origin and direction.

Definition at line 51 of file ray.h.

◆ ray() [3/3]

template<typename T >
cgv::math::ray< T, 3 >::ray ( const fvec< T, 2 > &  screen_coord,
const fvec< unsigned, 2 > &  viewport_size,
const fvec< T, 3 > &  eye_position,
const fmat< T, 4, 4 > &  view_projection_matrix 
)
inline

Construct a ray from a given screen coordinate and view parameters.

This is typically used to create a viewing ray that originates at the eye and goes through a pixel on the screen.

Parameters
screen_coordthe screen pixel coordinate with (0,0) in the bottom left corner.
viewport_sizethe screen size in pixels.
eye_positionthe location of the eye/camera.
view_projection_matrixthe current view and projection matrix with no (or identity) model transformation.

Definition at line 61 of file ray.h.

References cgv::math::fvec< T, N >::w(), cgv::math::fvec< T, N >::x(), and cgv::math::fvec< T, N >::y().

Member Function Documentation

◆ position()

template<typename T >
fvec< T, 3 > cgv::math::ray< T, 3 >::position ( float  t) const
inline

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

Definition at line 74 of file ray.h.

Member Data Documentation

◆ direction

template<typename T >
fvec<T, 3> cgv::math::ray< T, 3 >::direction

Definition at line 42 of file ray.h.

◆ origin

template<typename T >
fvec<T, 3> cgv::math::ray< T, 3 >::origin

Definition at line 41 of file ray.h.


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