cpe::ray Class Reference

Straight ray (initial position + direction) used for ray-tracing algorithm. More...

+ Collaboration diagram for cpe::ray:

List of all members.

Public Member Functions

 ray ()
 empty constructor
 ray (const v3 &_x0, const v3 &_u)
 direct constructor (position+direction)
const v3x0 () const
 get initial position
v3x0 ()
 get initial position
const v3u () const
 get direction
v3u ()
 get direction
v3 operator() (const double &t) const
 evaluate 3D position at x0+t*u
ray reflected_ray (const v3 &n) const
 Compute the reflected ray of the current one given the normal.
void offset (const double &epsilon=1e-8)
 offset the ray by epsilon in the direction of the normal

Static Public Member Functions

static ray generate_ray_from_camera (const camera &cam, const double &alpha_x, const double &alpha_y)
 helper static method to generate a ray given a camera position and a screen definition

Private Attributes

v3 internal_x0
 internal initial position of the ray
v3 internal_u
 internal direction of the ray

Detailed Description

Straight ray (initial position + direction) used for ray-tracing algorithm.


Constructor & Destructor Documentation

empty constructor

Referenced by generate_ray_from_camera(), and reflected_ray().

cpe::ray::ray ( const v3 _x0,
const v3 _u 
)

direct constructor (position+direction)


Member Function Documentation

ray cpe::ray::generate_ray_from_camera ( const camera cam,
const double &  alpha_x,
const double &  alpha_y 
) [static]

helper static method to generate a ray given a camera position and a screen definition

References cpe::camera::get_center(), cpe::camera::get_screen_coordinate(), and ray().

Referenced by cpe::ray_tracer::trace().

+ Here is the call graph for this function:

void cpe::ray::offset ( const double &  epsilon = 1e-8)

offset the ray by epsilon in the direction of the normal

References internal_u, and internal_x0.

v3 cpe::ray::operator() ( const double &  t) const

evaluate 3D position at x0+t*u

References internal_u, and internal_x0.

ray cpe::ray::reflected_ray ( const v3 n) const

Compute the reflected ray of the current one given the normal.

References cpe::v3::dot(), internal_u, internal_x0, cpe::v3::normalized(), and ray().

+ Here is the call graph for this function:

const v3 & cpe::ray::u ( ) const

get direction

References internal_u.

Referenced by cpe::plane::intersect(), and cpe::sphere::intersect().

v3 & cpe::ray::u ( )

get direction

References internal_u.

const v3 & cpe::ray::x0 ( ) const

get initial position

References internal_x0.

Referenced by cpe::plane::intersect(), and cpe::sphere::intersect().

get initial position

References internal_x0.


Member Data Documentation

internal direction of the ray

Referenced by offset(), operator()(), reflected_ray(), and u().

internal initial position of the ray

Referenced by offset(), operator()(), reflected_ray(), and x0().


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