KrisLibrary
1.0.0
|
A 4D vector class. More...
#include <primitives.h>
Public Member Functions | |
Vector4 (const Vector4 &) | |
Vector4 (Real x) | |
Vector4 (Real x, Real y, Real z, Real w=One) | |
Vector4 (const Real *data) | |
Vector4 (const Vector3 &) | |
bool | operator== (const Vector4 &) const |
bool | operator!= (const Vector4 &) const |
const Vector4 & | operator= (const Vector4 &) |
void | operator+= (const Vector4 &) |
void | operator-= (const Vector4 &) |
void | operator*= (Real) |
void | operator/= (Real) |
void | operator+= (const Vector3 &) |
void | operator-= (const Vector3 &) |
Real & | operator[] (int) |
const Real & | operator[] (int) const |
operator Vector3 () const | |
operator Real * () | |
operator const Real * () const | |
void | add (const Vector4 &a, const Vector4 &b) |
void | sub (const Vector4 &a, const Vector4 &b) |
void | mul (const Vector4 &a, Real b) |
void | div (const Vector4 &a, Real b) |
void | madd (const Vector4 &a, Real b) |
void | add (const Vector4 &a, const Vector3 &b) |
void | sub (const Vector4 &a, const Vector3 &b) |
Real | dot (const Vector4 &a) const |
Real | dot3 (const Vector4 &a) const |
Real | dot3 (const Vector3 &a) const |
Real | distance (const Vector4 &a) const |
Real | distanceSquared (const Vector4 &a) const |
Real | norm () const |
Real | normSquared () const |
Real | length () const |
Real | minElement (int *index=NULL) const |
Real | maxElement (int *index=NULL) const |
Real | minAbsElement (int *index=NULL) const |
Real | maxAbsElement (int *index=NULL) const |
void | set (const Vector4 &) |
void | set (Real x) |
void | set (Real x, Real y, Real z, Real w=One) |
void | set (const Real *data) |
void | setZero () |
void | setVector (const Vector3 &) |
sets w = 0 | |
void | setHomogeneous (const Vector3 &) |
sets w = 1 | |
void | setNegative (const Vector4 &) |
void | setNormalized (const Vector4 &) |
void | setProjection (const Vector4 &, const Vector4 &) |
void | setMinimum (const Vector4 &, const Vector4 &) |
void | setMinimum (const Vector4 &) |
void | setMaximum (const Vector4 &, const Vector4 &) |
void | setMaximum (const Vector4 &) |
void | get (Vector4 &) const |
void | get (Real &x, Real &y, Real &z, Real &w) const |
void | get (Real data[4]) const |
void | get (Vector3 &) const |
void | getNegative (Vector4 &) const |
void | getNormalized (Vector4 &) const |
void | inplaceNegative () |
void | inplaceMul (Real) |
void | inplaceDiv (Real) |
void | inplaceNormalize () |
bool | isZero (Real eps=Zero) const |
bool | isEqual (const Vector4 &, Real eps=Zero) const |
bool | Read (File &) |
bool | Write (File &) const |
Public Attributes | |
union { | |
Real data [4] | |
struct { | |
Real x | |
Real y | |
Real z | |
Real w | |
} | |
}; | |
A 4D vector class.
The elements can be accessed as (x,y,z,w), or using square brackets [{0,1,2,3}].