|
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. | |
| ~Ray () | |
| Empty. | |
| Ray | Reflect (const Vector &, const Vector &) |
| Compute the reflected ray from a ray hitting a surface. | |
| Vector | operator() (const double &) const |
| Computes the location of a vertex along the ray. | |
| 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. | |
| Ray | Translated (const Vector &) const |
| Translate the ray. | |
| Ray | Rotated (const Matrix &) const |
| Rotate the ray. | |
| Ray | InverseTransform (const Frame &) const |
| Transform a ray. | |
| Vector | Origin () const |
| Return the origin of the ray. | |
| Vector | Direction () const |
| Return the direction of the ray. | |
Protected Attributes | |
| Vector | c = Vector::Null |
| Origin of the ray. | |
| Vector | n = Vector::Z |
| Direction. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Ray &ray) |
| Overloaded. | |
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. |