#include <vec3.h>
Public Member Functions | |
Vec3 () | |
Constructor. | |
Vec3 (const T X, const T Y, const T Z) | |
Constructor. | |
Vec3 (const T A) | |
Constructor. | |
Vec3 (const Vec3< T > &v) | |
Constructor. | |
T | operator[] (const int i) const |
operator [] | |
T * | operator * () |
operator * | |
Vec3< T > | operator- () const |
Negate vector. | |
Vec3< T > & | operator= (const Vec3< T > &v) |
Assignment operator. | |
Vec3< T > & | operator+= (const Vec3< T > &v) |
Add and assign operator. | |
Vec3< T > & | operator-= (const Vec3< T > &v) |
Subtract and assign operator. | |
Vec3< T > & | Clamp (const T &low, const T &high) |
Clamp values in vector. | |
Vec3< T > | Cross (const Vec3< T > &v) const |
Cross product. | |
T | Dot (const Vec3< T > &v) const |
Dot product. | |
T | Norm () const |
Norm of the vector. | |
Vec3< T > & | Normalize () |
Normalize the vector. | |
Data Fields | |
T | x |
T | y |
T | z |
Vector type for 3D with most of the common operators included.
Constructor.
Sets the components of the vector to 0.
Constructor.
Sets the components of the vector.
X | x-value. | |
Y | y-value. | |
Z | z-value. |
Constructor.
Sets the components of the vector to a scalar.
A | value for all components of the vector. |
Constructor.
Sets the vector to another vector.
v | vector to initialize to. |
T Vec3< T >::operator[] | ( | const int | i | ) | const [inline] |
operator []
Access the elements of the vector using the [] operator.
i | number of component. |
T* Vec3< T >::operator * | ( | ) | [inline] |
operator *
Access the elements of the vecotr as a pointer.
Negate vector.
Return the vector negated.
Assignment operator.
Assign a vector to another.
the | vector to copy values from. |
Add and assign operator.
Add a vector to another.
v | vector to add from. |
Subtract and assign operator.
Subtract a vector from another.
v | vector to subtract from. |
Clamp values in vector.
Clamp the values in the vector between low and high.
low | lower limit for values. | |
high | high limit for values. |
Cross product.
Outer product between two vectors.
v | right vector in the cross product. |
Dot product.
Inner product between two vectors.
v | vector to do dot product with. |
T Vec3< T >::Norm | ( | ) | const [inline] |
Norm of the vector.
Calculate the length of the vector.
Normalize the vector.
Normalize the vector.