#include <vector.h>
Public Member Functions | |
Vector4D (void) | |
Constructs a 4D verctor with all components set to zero. | |
Vector4D (float X, float Y, float Z, float W) | |
Constructs a 3D vector from given component values. | |
Vector4D (const float *xyzw) | |
Constructs a 4D vector from a given float[4] array. | |
int | operator== (const Vector4D &v) const |
Tests wether two vectors are equal. | |
int | operator!= (const Vector4D &v) const |
Tests wether two vectors are different. | |
Vector4D | operator- (void) const |
Returns the vector in reverse direction with same length. | |
Vector4D | operator+ (const Vector4D &v) const |
Returns the sum of two vectors. | |
Vector4D | operator- (const Vector4D &v) const |
Subtracts two vectors. | |
Vector4D | operator * (const float f) const |
Multiplies the vector with a scalar. | |
float | operator * (const Vector4D &v) const |
Computes the dot product between the two vectors. | |
const float * | toFloatPointer (void) const |
Allows accessing the components via index. | |
Vector4D | modulate (const Vector4D &v) const |
Multiplies the i-th componenent of *this with the i-th component of v. | |
float | lengthSq (void) const |
Returnes the squared length of the vector. | |
void | colorNormalize (void) |
Clamps each component to the range [0,1]. | |
Public Attributes | |
float | x |
X component. | |
float | y |
Y component. | |
float | z |
Z component. | |
float | w |
W component. |
A vector class with self-explaining members.
int Vector4D::operator== | ( | const Vector4D & | v | ) | const [inline] |
Tests wether two vectors are equal.
int Vector4D::operator!= | ( | const Vector4D & | v | ) | const [inline] |
Tests wether two vectors are different.
Vector4D Vector4D::operator- | ( | void | ) | const [inline] |
Returns the vector in reverse direction with same length.
Subtracts two vectors.
Vector4D Vector4D::operator * | ( | const float | f | ) | const [inline] |
Multiplies the vector with a scalar.
f | Scaling factor. |
float Vector4D::operator * | ( | const Vector4D & | v | ) | const [inline] |
Computes the dot product between the two vectors.
const float* Vector4D::toFloatPointer | ( | void | ) | const [inline] |
Allows accessing the components via index.
Multiplies the i-th componenent of *this with the i-th component of v.
float Vector4D::lengthSq | ( | void | ) | const [inline] |
Returnes the squared length of the vector.
void Vector4D::colorNormalize | ( | void | ) | [inline] |
Clamps each component to the range [0,1].