Straight ray (initial position + direction) used for ray-tracing algorithm. More...
Public Member Functions | |
ray () | |
empty constructor | |
ray (const v3 &_x0, const v3 &_u) | |
direct constructor (position+direction) | |
const v3 & | x0 () const |
get initial position | |
v3 & | x0 () |
get initial position | |
const v3 & | u () const |
get direction | |
v3 & | u () |
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 |
Straight ray (initial position + direction) used for ray-tracing algorithm.
cpe::ray::ray | ( | ) |
empty constructor
Referenced by generate_ray_from_camera(), and reflected_ray().
cpe::ray::ray | ( | const v3 & | _x0, |
const v3 & | _u | ||
) |
direct constructor (position+direction)
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().
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().
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().
v3 & cpe::ray::x0 | ( | ) |
get initial position
References internal_x0.
v3 cpe::ray::internal_u [private] |
internal direction of the ray
Referenced by offset(), operator()(), reflected_ray(), and u().
v3 cpe::ray::internal_x0 [private] |
internal initial position of the ray
Referenced by offset(), operator()(), reflected_ray(), and x0().