|
Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
|
Localised vector class. More...
#include <euclidian.hpp>
Public Member Functions | |
| euclidian (const vector &origin, const vector &u) | |
| Constructor. More... | |
| const vector & | direction () const |
| The direction vector. | |
| const vector & | u () const |
| The direction vector (alias for euclidian::direction()) | |
| const vector & | origin () const |
| The position vector. | |
Friends | |
| euclidian | operator* (const matrix &, const euclidian &) |
| Matrix multiplication with an euclidian. More... | |
Localised vector class.
An euclidian represent a direction vector and a position vector.
Constructor.
Make a new euclidian from its origin and direction.
| origin | the euclidian location |
| u | the euclidian direction. Note that the vector is automaticaly transformed into a unit vector. |
Matrix multiplication with an euclidian.
| m | a 4x4 transformation matrix. |
| e | an euclidian. |
This operator is very usefull to map an euclidian in a new space reference.
euclidian e(vector(0.0, 0.0, 0.0), vector(0.0, 1.0, 0.0)); matrix m; m.translate(vector(1.0, 5.0, -2.0)); // translation m.rotate(45, 1.0, 0.0, 0.0); // 45° rotation along x-axis euclidian local_e = m*e; // map e into m referential.
The multiplication is defined for a matrix \(M\) and euclidian \(E\) as follow:
\begin{eqnarray*} (M\times E)_{origin} &=& M\times E_{origin} \\ (M\times E)_{direction} &=& M\times(E_{origin}+E_{direction}) - (M\times E)_{origin} \end{eqnarray*}
1.8.15