#include <vector4.h>
Generic four-element vector mathematics. Can be used with the four-by-four matrix class _Matrix4.
Public Member Functions | |
_Vector4 (_DONTCONSTRUCT dc) | |
_Vector4 () | |
_Vector4 (TYPE xIn, TYPE yIn, TYPE zIn, TYPE wIn) | |
_Vector4 (TYPE v) | |
_Vector4 (const Vector32 &v) | |
_Vector4 (const Vector32 &v, Float32 r) | |
_Vector4 (const Vector64 &v) | |
_Vector4 (const Vector64 &v, Float64 r) | |
void | SetZero () |
const TYPE | Dot (const _Vector4 &b) |
void | MakeVector3 () |
const _Vector4 & | operator+= (const _Vector4 &a) |
const _Vector4 & | operator*= (const Float a) |
Public Attributes | |
union { | |
struct { | |
TYPE x | |
TYPE y | |
TYPE z | |
TYPE w | |
} | |
TYPE m_prElements [4] | |
}; | |
Friends | |
const _Vector4 | operator- (const _Vector4 &a, const _Vector4 &b) |
const _Vector4 | operator+ (const _Vector4 &a, const _Vector4 &b) |
const _Vector4 | operator^ (const _Vector4 &a, const _Vector4 &b) |
const TYPE | Dot (const _Vector4 &a, const _Vector4 &b) |
const _Vector4 | operator* (const _Vector4 &a, TYPE b) |
const Vector & | GetVector3 (const _Vector4 &v) |
Bool | operator== (const _Vector4 &a, const _Vector4 &b) |
|
explicit |
Creates an uninitialized vector.
[in] | dc | Dummy argument. Pass DC. |
_Vector4 | ( | ) |
Default constructor. Creates a (0, 0, 0, 1) vector.
_Vector4 | ( | TYPE | xIn, |
TYPE | yIn, | ||
TYPE | zIn, | ||
TYPE | wIn | ||
) |
Creates a (x, y, z, w) vector.
[in] | xIn | The X component of the vector. |
[in] | yIn | The Y component of the vector. |
[in] | zIn | The Z component of the vector. |
[in] | wIn | The W component of the vector. |
|
explicit |
Creates a (v, v, v, v) vector.
[in] | v | The scalar value. |
Creates a (v.x, v.y, v.z, 1.0) vector.
[in] | v | The Vector32 value. |
Creates a (v.x, v.y, v.z, 1.0) vector.
[in] | v | The Vector64 value. |
void SetZero | ( | ) |
Sets all vector components to zero.
const TYPE Dot | ( | const _Vector4< TYPE > & | b) |
Calculates the dot product of the vector and vector b.
[in] | b | The other vector. |
void MakeVector3 | ( | ) |
Normalizes the vector so that w
is 1.
Adds two vectors together and sets the left-hand vector to the result.
[in] | a | The right-hand vector. |
Multiplies each vector components by a scalar and set the vector to the result.
[in] | a | The right-hand scalar. |
Subtracts two vectors.
[in] | a | The first vector. |
[in] | b | The second vector. |
Adds two vectors.
[in] | a | The first vector. |
[in] | b | The second vector. |
Multiplies each vector component in the left-hand vector by its counterpart in the right-hand vector.
[in] | a | The first vector. |
[in] | b | The second vector. |
Calculates the dot product of two vectors.
[in] | a | The first vector. |
[in] | b | The second vector. |
Multiplies the vector by a scalar.
[in] | a | The vector. |
[in] | b | The scalar. |
Equality operator. Checks if the two vectors are equal.
[in] | a | The first vector. |
[in] | b | The second vector. |
TYPE x |
X component of the vector.
TYPE y |
Y component of the vector.
TYPE z |
Z component of the vector.
TYPE w |
W component of the vector.
union { ... } |