#include <GLVector.h>
Collaboration diagram for mathglpp::GLVector4< T >:
Definition at line 885 of file GLVector.h.
Public Types | |
enum | { D = 4 } |
Keep the dimensions as a defined enum. More... | |
Public Member Functions | |
GLVector4 () | |
Create an uninitialised vector. | |
GLVector4 (const T &v) | |
Create an initialised vector. | |
GLVector4 (const T &v1, const T &v2, const T &v3, const T &v4) | |
Create an initialised vector from values. | |
GLVector4 (const GLVector4 &gv) | |
Copy a vector. | |
GLVector4 (const T *f) | |
Create a vector from an array. | |
~GLVector4 () | |
Default destructor. | |
void | set (const T &v1, const T &v2, const T &v3, const T &v4) |
element by element initialiser | |
T & | operator[] (int ind) |
element by element accessor | |
operator T * (void) | |
implicit casting to a pointer | |
operator const T * (void) const | |
implicit casting to a const pointer | |
void | glScale () const |
GL interface, glScale(). | |
void | glRotate (const T &ang) const |
GL interface, glRotate(). | |
void | glTranslate () const |
GL interface, glTranslate(). | |
void | glVertex () const |
GL interface, glVertex(). | |
void | glNormal () const |
GL interface, glNormal(). | |
void | copyTo (T *vec) const |
copy values to a array | |
const GLVector4 | operator+ (const GLVector4 &gv) const |
Get the sum of this and a vector. | |
const GLVector4 | operator- (const GLVector4 &gv) const |
Get the difference of this and a vector. | |
const GLVector4 | operator * (const GLVector4 &gv) const |
Get the element-by-element product of this and a vector. | |
const GLVector4 | operator/ (const GLVector4 &gv) const |
Get the element-by-element quota of this and a vector. | |
const GLVector4 | operator * (const T &v) const |
Get the element-by-element product of this and a scalar. | |
const GLVector4 | operator/ (const T &v) const |
Get the element-by-element quota of this and a scalar. | |
GLVector4 & | operator+= (const GLVector4 &gv) |
Add a vector to this. | |
GLVector4 & | operator-= (const GLVector4 &gv) |
Subtract a vector from this. | |
GLVector4 & | operator *= (const T &f) |
Multiply this by a scalar. | |
GLVector4 & | operator/= (const T &f) |
Divide this by a scalar. | |
GLVector4 & | operator= (const GLVector4 &gv) |
copy this from a vector | |
bool | operator== (const GLVector4 &v) |
Equality check. NB. May not be constant time, depending on memcmp. | |
const GLVector4 | operator- () const |
negate this | |
const T | dot (const GLVector4 &gv) const |
Get the dot product of this and a vector. | |
T | length () const |
Get the length of this. | |
T | lengthSqr () const |
Get the length squared, less computation than length(). | |
const GLVector4 | getCross (const GLVector4 &gv) const |
Get the cross-product of this and a vector. | |
GLVector4 & | cross (const GLVector4 &gv) |
Apply the cross-product of this and a vector. | |
const GLVector4 | unit () const |
Get the the unit vector of this. | |
GLVector4 & | normalize () |
Normalize this, makes this a unit vector, US spelling. | |
const T | projection (const GLVector4 &in) const |
Get the projection of this and a vector. | |
GLVector4 | orthogonalProjection (const GLVector4 &in) const |
Get the orthogonal projection of this and a vector. | |
GLVector4 | vectorProjection (const GLVector4 &in) const |
Get the vector projection of this and a vector. | |
template<> | |
void | glScale () const |
template<> | |
void | glScale () const |
template<> | |
void | glRotate (const GLfloat &ang) const |
template<> | |
void | glRotate (const GLdouble &ang) const |
template<> | |
void | glTranslate () const |
template<> | |
void | glTranslate () const |
template<> | |
void | glVertex () const |
template<> | |
void | glNormal () const |
template<> | |
void | glNormal () const |
template<> | |
const GLVector4< GLfloat > | operator/ (const GLfloat &v) const |
template<> | |
const GLVector4< GLdouble > | operator/ (const GLdouble &v) const |
Public Attributes | |
union { | |
T val [D] | |
struct { | |
T x | |
T y | |
T z | |
T w | |
} | |
}; | |
Value array Anonymous union and struct by sebastien bloc (sebastien.bloc@free.fr). |
anonymous enum |
mathglpp::GLVector4< T >::GLVector4 | ( | ) | [inline] |
Create an uninitialised vector.
Definition at line 892 of file GLVector.h.
Referenced by mathglpp::GLVector4< T >::getCross(), mathglpp::GLVector4< T >::operator *(), mathglpp::GLVector4< T >::operator+(), mathglpp::GLVector4< T >::operator-(), and mathglpp::GLVector4< T >::operator/().
mathglpp::GLVector4< T >::GLVector4 | ( | const T & | v | ) | [inline] |
Create an initialised vector.
Definition at line 896 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
mathglpp::GLVector4< T >::GLVector4 | ( | const T & | v1, | |
const T & | v2, | |||
const T & | v3, | |||
const T & | v4 | |||
) | [inline] |
Create an initialised vector from values.
Definition at line 900 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
mathglpp::GLVector4< T >::GLVector4 | ( | const GLVector4< T > & | gv | ) | [inline] |
Copy a vector.
Definition at line 904 of file GLVector.h.
References mathglpp::GLVector4< T >::D, and mathglpp::GLVector4< T >::val.
mathglpp::GLVector4< T >::GLVector4 | ( | const T * | f | ) | [inline] |
Create a vector from an array.
Definition at line 908 of file GLVector.h.
References mathglpp::GLVector4< T >::D, and mathglpp::GLVector4< T >::val.
mathglpp::GLVector4< T >::~GLVector4 | ( | ) | [inline] |
void mathglpp::GLVector4< T >::set | ( | const T & | v1, | |
const T & | v2, | |||
const T & | v3, | |||
const T & | v4 | |||
) | [inline] |
element by element initialiser
Definition at line 915 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
T& mathglpp::GLVector4< T >::operator[] | ( | int | ind | ) | [inline] |
element by element accessor
Definition at line 919 of file GLVector.h.
References mathglpp::GLVector4< T >::val.
00920 { return val[ind]; }
mathglpp::GLVector4< T >::operator T * | ( | void | ) | [inline] |
implicit casting to a pointer
Definition at line 923 of file GLVector.h.
References mathglpp::GLVector4< T >::val.
00924 { return val; }
mathglpp::GLVector4< T >::operator const T * | ( | void | ) | const [inline] |
implicit casting to a const pointer
Definition at line 927 of file GLVector.h.
References mathglpp::GLVector4< T >::val.
00928 { return val; }
void mathglpp::GLVector4< T >::glScale | ( | ) | const [inline] |
GL interface, glScale().
void mathglpp::GLVector4< T >::glRotate | ( | const T & | ang | ) | const [inline] |
GL interface, glRotate().
void mathglpp::GLVector4< T >::glTranslate | ( | ) | const [inline] |
GL interface, glTranslate().
void mathglpp::GLVector4< T >::glVertex | ( | ) | const [inline] |
GL interface, glVertex().
Definition at line 937 of file GLVector.h.
References mathglpp::GLVector4< T >::val.
00937 { mathglpp::glVertexv<D,T>(val); }
void mathglpp::GLVector4< T >::glNormal | ( | ) | const [inline] |
GL interface, glNormal().
void mathglpp::GLVector4< T >::copyTo | ( | T * | vec | ) | const [inline] |
copy values to a array
Definition at line 942 of file GLVector.h.
References mathglpp::GLVector4< T >::D, and mathglpp::GLVector4< T >::val.
Referenced by mathglpp::GLCubicHermiteCurve4< T >::GLCubicHermiteCurve4().
const GLVector4 mathglpp::GLVector4< T >::operator+ | ( | const GLVector4< T > & | gv | ) | const [inline] |
Get the sum of this and a vector.
Definition at line 946 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
const GLVector4 mathglpp::GLVector4< T >::operator- | ( | const GLVector4< T > & | gv | ) | const [inline] |
Get the difference of this and a vector.
Definition at line 952 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
const GLVector4 mathglpp::GLVector4< T >::operator * | ( | const GLVector4< T > & | gv | ) | const [inline] |
Get the element-by-element product of this and a vector.
Definition at line 958 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
const GLVector4 mathglpp::GLVector4< T >::operator/ | ( | const GLVector4< T > & | gv | ) | const [inline] |
Get the element-by-element quota of this and a vector.
Definition at line 964 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
const GLVector4 mathglpp::GLVector4< T >::operator * | ( | const T & | v | ) | const [inline] |
Get the element-by-element product of this and a scalar.
Definition at line 970 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
const GLVector4 mathglpp::GLVector4< T >::operator/ | ( | const T & | v | ) | const [inline] |
Get the element-by-element quota of this and a scalar.
Definition at line 977 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
GLVector4& mathglpp::GLVector4< T >::operator+= | ( | const GLVector4< T > & | gv | ) | [inline] |
Add a vector to this.
Definition at line 983 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
00984 { 00985 x += gv.x; 00986 y += gv.y; 00987 z += gv.z; 00988 w += gv.w; 00989 return *this; 00990 }
GLVector4& mathglpp::GLVector4< T >::operator-= | ( | const GLVector4< T > & | gv | ) | [inline] |
Subtract a vector from this.
Definition at line 993 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
00994 { 00995 x -= gv.x; 00996 y -= gv.y; 00997 z -= gv.z; 00998 w -= gv.w; 00999 return *this; 01000 }
GLVector4& mathglpp::GLVector4< T >::operator *= | ( | const T & | f | ) | [inline] |
Multiply this by a scalar.
Definition at line 1003 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
GLVector4& mathglpp::GLVector4< T >::operator/= | ( | const T & | f | ) | [inline] |
Divide this by a scalar.
Definition at line 1013 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
GLVector4& mathglpp::GLVector4< T >::operator= | ( | const GLVector4< T > & | gv | ) | [inline] |
copy this from a vector
Definition at line 1023 of file GLVector.h.
References mathglpp::GLVector4< T >::D, and mathglpp::GLVector4< T >::val.
bool mathglpp::GLVector4< T >::operator== | ( | const GLVector4< T > & | v | ) | [inline] |
Equality check. NB. May not be constant time, depending on memcmp.
Definition at line 1027 of file GLVector.h.
References mathglpp::GLVector4< T >::D, and mathglpp::GLVector4< T >::val.
const GLVector4 mathglpp::GLVector4< T >::operator- | ( | ) | const [inline] |
negate this
Definition at line 1031 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
const T mathglpp::GLVector4< T >::dot | ( | const GLVector4< T > & | gv | ) | const [inline] |
Get the dot product of this and a vector.
Definition at line 1037 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Referenced by mathglpp::GLVector4< T >::projection(), and mathglpp::GLVector4< T >::vectorProjection().
T mathglpp::GLVector4< T >::length | ( | ) | const [inline] |
Get the length of this.
Definition at line 1041 of file GLVector.h.
References mathglpp::GLVector4< T >::lengthSqr().
Referenced by mathglpp::GLVector4< T >::normalize(), and mathglpp::GLVector4< T >::unit().
01042 { return sqrt(lengthSqr()); }
Here is the call graph for this function:
T mathglpp::GLVector4< T >::lengthSqr | ( | ) | const [inline] |
Get the length squared, less computation than length().
Definition at line 1045 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Referenced by mathglpp::GLVector4< T >::length().
const GLVector4 mathglpp::GLVector4< T >::getCross | ( | const GLVector4< T > & | gv | ) | const [inline] |
Get the cross-product of this and a vector.
Definition at line 1049 of file GLVector.h.
References mathglpp::GLVector4< T >::GLVector4(), mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
Here is the call graph for this function:
GLVector4& mathglpp::GLVector4< T >::cross | ( | const GLVector4< T > & | gv | ) | [inline] |
Apply the cross-product of this and a vector.
Definition at line 1055 of file GLVector.h.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
01056 { 01057 T temp[] = { x, y, z, w }; 01058 01059 x = temp[1] * gv.z - temp[2] * gv.y; 01060 y = temp[2] * gv.w - temp[3] * gv.z; 01061 z = temp[3] * gv.x - temp[0] * gv.w; 01062 w = temp[0] * gv.y - temp[1] * gv.x; 01063 01064 return *this; 01065 }
const GLVector4 mathglpp::GLVector4< T >::unit | ( | ) | const [inline] |
Get the the unit vector of this.
Definition at line 1068 of file GLVector.h.
References mathglpp::GLVector4< T >::length().
01069 { 01070 return (*this)/length(); 01071 }
Here is the call graph for this function:
GLVector4& mathglpp::GLVector4< T >::normalize | ( | ) | [inline] |
Normalize this, makes this a unit vector, US spelling.
Definition at line 1074 of file GLVector.h.
References mathglpp::GLVector4< T >::length().
01075 { 01076 (*this)/=length(); 01077 return *this; 01078 }
Here is the call graph for this function:
const T mathglpp::GLVector4< T >::projection | ( | const GLVector4< T > & | in | ) | const [inline] |
Get the projection of this and a vector.
Definition at line 1081 of file GLVector.h.
References mathglpp::GLVector4< T >::dot().
01082 { return dot(in); }
Here is the call graph for this function:
GLVector4 mathglpp::GLVector4< T >::orthogonalProjection | ( | const GLVector4< T > & | in | ) | const [inline] |
Get the orthogonal projection of this and a vector.
Definition at line 1085 of file GLVector.h.
References mathglpp::GLVector4< T >::vectorProjection().
01086 { return in - vectorProjection(in); }
Here is the call graph for this function:
GLVector4 mathglpp::GLVector4< T >::vectorProjection | ( | const GLVector4< T > & | in | ) | const [inline] |
Get the vector projection of this and a vector.
Definition at line 1089 of file GLVector.h.
References mathglpp::GLVector4< T >::dot().
Referenced by mathglpp::GLVector4< T >::orthogonalProjection().
01090 { return (*this) * dot(in); }
Here is the call graph for this function:
void mathglpp::GLVector4< GLbyte >::glVertex | ( | ) | const [inline] |
Closest possible fit
Definition at line 227 of file GLVector.cpp.
References mathglpp::GLVector4< T >::w, mathglpp::GLVector4< T >::x, mathglpp::GLVector4< T >::y, and mathglpp::GLVector4< T >::z.
union { ... } |
Value array Anonymous union and struct by sebastien bloc (sebastien.bloc@free.fr).