| home | project pages | download | documentation | doxygen | contact |
#include <Vector.h>
A homogenious 3D vector has 4 values: x, y, z, w. The w value can have one of two values; 0.0 means it is a vector, while 1.0 means it is a point.
Both a point and a vector can be multiplied by a 4 x 4 affine Matrix; to be scaled, sheared, rotated and translated (translation only for points). normal 3D points multiplied by a 3 x 3 matrix needed a seperate translation step.
This vector template is compatible with both floating point values and with interval values.
Public Member Functions | |
| TVector (void) | |
| Construct a zero vector. | |
| TVector (T _x, T _y, T _z) | |
| Construct a vector. | |
| TVector (T _x, T _y, T _z, T _w) | |
| Construct a vector or point. | |
| TVector | operator- () const |
| Invert the vector. | |
| T | length () const |
| Return the length of the vector. | |
| TVector | normalize () const |
| Return a vector with a length of 1.0 in the same orientation as the original vector. | |
Public Attributes | |
| T | x |
| x-axis value. | |
| T | y |
| y-axis value. | |
| T | z |
| z-axis value. | |
| T | w |
| 0.0 means vector, 1.0 means point. | |
| camvox::TVector< T >::TVector | ( | void | ) | [inline] |
Construct a zero vector.
| camvox::TVector< T >::TVector | ( | T | _x, | |
| T | _y, | |||
| T | _z | |||
| ) | [inline] |
Construct a vector.
| _x | x-axis value | |
| _y | y-axis value | |
| _z | z-axis value |
| camvox::TVector< T >::TVector | ( | T | _x, | |
| T | _y, | |||
| T | _z, | |||
| T | _w | |||
| ) | [inline] |
Construct a vector or point.
| _x | x-axis value | |
| _y | y-axis value | |
| _z | z-axis value | |
| _w | 0.0 means vector, 1.0 means point |
| TVector camvox::TVector< T >::operator- | ( | ) | const [inline] |
Invert the vector.
Or mirror the point throught the origin.
| T camvox::TVector< T >::length | ( | ) | const [inline] |
Return the length of the vector.
Or the distance between the point and the origin.
| TVector camvox::TVector< T >::normalize | ( | ) | const [inline] |
Return a vector with a length of 1.0 in the same orientation as the original vector.
Or translate the point to lay on the surface of a unit sphere.
| T camvox::TVector< T >::x |
x-axis value.
| T camvox::TVector< T >::y |
y-axis value.
| T camvox::TVector< T >::z |
z-axis value.
| T camvox::TVector< T >::w |
0.0 means vector, 1.0 means point.