Core 1.0
|
A ray characterized by its origin an unit direction vector. More...
#include <ray.h>
Public Member Functions | |
Ray () | |
Empty. | |
Ray (const Vector &, const Vector &) | |
Creates a ray. More... | |
~Ray () | |
Empty. | |
Ray | Reflect (const Vector &, const Vector &) |
Compute the reflected ray from a ray hitting a surface. More... | |
Vector | operator() (const double &) const |
Computes the location of a vertex along the ray. More... | |
double | Length () const |
Gets the length of the direction vector. | |
double | LengthSquared () const |
Gets the squared length of the direction vector. | |
Ray | Scaled (const Vector &) const |
Scale the ray. More... | |
Ray | Translated (const Vector &) const |
Translate the ray. More... | |
Ray | Rotated (const Matrix &) const |
Rotate the ray. More... | |
Vector | Origin () const |
Return the origin of the ray. | |
Vector | Direction () const |
Return the direction of the ray. | |
Protected Attributes | |
Vector | c |
Origin of the ray. | |
Vector | n |
Direction. | |
Friends | |
std::ostream & | operator<< (std::ostream &, const Ray &) |
Overloaded. More... | |
A ray characterized by its origin an unit direction vector.
This class should be used in ray-object intersection methods and for ray-tracing.
Creates a ray.
The direction should be unit:
p | Origin. |
d | Direction (should be unit vector). |
|
inline |
Computes the location of a vertex along the ray.
t | Parameter. |
Compute the reflected ray from a ray hitting a surface.
The origin of the ray is defined as the argument intersection point, and direction is set according to the normal of the surface at intersection point.
p | Intersection point. |
normal | Surface outgoing normal. |
Scale the ray.
This function changes both the direction vector and origin. Note that the direction is kept unit.
s | Scaling vector. |
|
friend |
Overloaded.
s | Stream. |
ray | The ray. |