#include <GLVector.h>
Collaboration diagram for mathglpp::GLVector2< T >:
Definition at line 36 of file GLVector.h.
Public Types | |
enum | { D = 2 } |
Public Member Functions | |
GLVector2 () | |
Create an uninitialised vector. | |
GLVector2 (const T &v) | |
Create an initialised vector. | |
GLVector2 (const T &v1, const T &v2) | |
Create an initialised vector from values. | |
GLVector2 (const GLVector2 &gv) | |
Copy a vector. | |
GLVector2 (const T *f) | |
Create a vector from an array. | |
~GLVector2 () | |
Default destructor. | |
void | set (const T &v1, const T &v2) |
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 GLVector2 | operator+ (const GLVector2 &gv) const |
Get the sum of this and a vector. | |
const GLVector2 | operator- (const GLVector2 &gv) const |
Get the difference of this and a vector. | |
const GLVector2 | operator * (const GLVector2 &gv) const |
Get the element-by-element product of this and a vector. | |
const GLVector2 | operator/ (const GLVector2 &gv) const |
Get the element-by-element quota of this and a vector. | |
const GLVector2 | operator * (const T &v) const |
Get the element-by-element product of this and a scalar. | |
const GLVector2 | operator/ (const T &v) const |
Get the element-by-element quota of this and a scalar. | |
GLVector2 & | operator+= (const GLVector2 &gv) |
Add a vector to this. | |
GLVector2 & | operator-= (const GLVector2 &gv) |
Subtract a vector from this. | |
GLVector2 & | operator *= (const T &f) |
Multiply this by a scalar. | |
GLVector2 & | operator/= (const T &f) |
Divide this by a scalar. | |
GLVector2 & | operator= (const GLVector2 &v) |
copy this from a vector | |
bool | operator== (const GLVector2 &v) |
Equality check. NB. May not be constant time, depending on memcmp. | |
const GLVector2 | operator- () const |
negate this | |
const T | dot (const GLVector2 &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 GLVector2 | unit () const |
Get the the unit vector of this. | |
GLVector2 & | normalize () |
Normalize this, makes this a unit vector, US spelling. | |
const T | projection (const GLVector2 &in) const |
Get the projection of this and a vector. | |
GLVector2 | orthogonalProjection (const GLVector2 &in) const |
Get the orthogonal projection of this and a vector. | |
GLVector2 | vectorProjection (const GLVector2 &in) const |
Get the vector projection of this and a vector. | |
template<> | |
void | glScale () const |
template<> | |
void | glScale () const |
template<> | |
void | glScale () const |
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 |
Public Attributes | |
union { | |
T val [D] | |
struct { | |
T x | |
T y | |
} | |
}; | |
Value array Anonymous union and struct by sebastien bloc (sebastien.bloc@free.fr). |
anonymous enum |
mathglpp::GLVector2< T >::GLVector2 | ( | ) | [inline] |
Create an uninitialised vector.
Definition at line 42 of file GLVector.h.
Referenced by mathglpp::GLVector2< T >::operator *(), mathglpp::GLVector2< T >::operator+(), mathglpp::GLVector2< T >::operator-(), and mathglpp::GLVector2< T >::operator/().
mathglpp::GLVector2< T >::GLVector2 | ( | const T & | v | ) | [inline] |
Create an initialised vector.
Definition at line 46 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
mathglpp::GLVector2< T >::GLVector2 | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
Create an initialised vector from values.
Definition at line 50 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
mathglpp::GLVector2< T >::GLVector2 | ( | const GLVector2< T > & | gv | ) | [inline] |
Copy a vector.
Definition at line 54 of file GLVector.h.
References mathglpp::GLVector2< T >::D, and mathglpp::GLVector2< T >::val.
mathglpp::GLVector2< T >::GLVector2 | ( | const T * | f | ) | [inline] |
Create a vector from an array.
Definition at line 58 of file GLVector.h.
References mathglpp::GLVector2< T >::D, and mathglpp::GLVector2< T >::val.
mathglpp::GLVector2< T >::~GLVector2 | ( | ) | [inline] |
void mathglpp::GLVector2< T >::set | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
element by element initialiser
Definition at line 65 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
T& mathglpp::GLVector2< T >::operator[] | ( | int | ind | ) | [inline] |
element by element accessor
Definition at line 69 of file GLVector.h.
References mathglpp::GLVector2< T >::val.
00070 { return val[ind]; }
mathglpp::GLVector2< T >::operator T * | ( | void | ) | [inline] |
implicit casting to a pointer
Definition at line 73 of file GLVector.h.
References mathglpp::GLVector2< T >::val.
00074 { return val; }
mathglpp::GLVector2< T >::operator const T * | ( | void | ) | const [inline] |
implicit casting to a const pointer
Definition at line 77 of file GLVector.h.
References mathglpp::GLVector2< T >::val.
00078 { return val; }
void mathglpp::GLVector2< T >::glScale | ( | ) | const [inline] |
GL interface, glScale().
void mathglpp::GLVector2< T >::glRotate | ( | const T & | ang | ) | const [inline] |
GL interface, glRotate().
void mathglpp::GLVector2< T >::glTranslate | ( | ) | const [inline] |
GL interface, glTranslate().
void mathglpp::GLVector2< T >::glVertex | ( | ) | const [inline] |
GL interface, glVertex().
Definition at line 87 of file GLVector.h.
References mathglpp::GLVector2< T >::val.
00087 { mathglpp::glVertexv<D,T>(val); }
void mathglpp::GLVector2< T >::glNormal | ( | ) | const [inline] |
GL interface, glNormal().
void mathglpp::GLVector2< T >::copyTo | ( | T * | vec | ) | const [inline] |
copy values to a array
Definition at line 92 of file GLVector.h.
References mathglpp::GLVector2< T >::val.
00093 { memmove(vec,val,2*sizeof(T)); }
const GLVector2 mathglpp::GLVector2< T >::operator+ | ( | const GLVector2< T > & | gv | ) | const [inline] |
Get the sum of this and a vector.
Definition at line 96 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
const GLVector2 mathglpp::GLVector2< T >::operator- | ( | const GLVector2< T > & | gv | ) | const [inline] |
Get the difference of this and a vector.
Definition at line 102 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
const GLVector2 mathglpp::GLVector2< T >::operator * | ( | const GLVector2< T > & | gv | ) | const [inline] |
Get the element-by-element product of this and a vector.
Definition at line 108 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
const GLVector2 mathglpp::GLVector2< T >::operator/ | ( | const GLVector2< T > & | gv | ) | const [inline] |
Get the element-by-element quota of this and a vector.
Definition at line 114 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
const GLVector2 mathglpp::GLVector2< T >::operator * | ( | const T & | v | ) | const [inline] |
Get the element-by-element product of this and a scalar.
Definition at line 120 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
const GLVector2 mathglpp::GLVector2< T >::operator/ | ( | const T & | v | ) | const [inline] |
Get the element-by-element quota of this and a scalar.
Definition at line 126 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
GLVector2& mathglpp::GLVector2< T >::operator+= | ( | const GLVector2< T > & | gv | ) | [inline] |
Add a vector to this.
Definition at line 132 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
GLVector2& mathglpp::GLVector2< T >::operator-= | ( | const GLVector2< T > & | gv | ) | [inline] |
Subtract a vector from this.
Definition at line 140 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
GLVector2& mathglpp::GLVector2< T >::operator *= | ( | const T & | f | ) | [inline] |
Multiply this by a scalar.
Definition at line 148 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
GLVector2& mathglpp::GLVector2< T >::operator/= | ( | const T & | f | ) | [inline] |
Divide this by a scalar.
Definition at line 156 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
GLVector2& mathglpp::GLVector2< T >::operator= | ( | const GLVector2< T > & | v | ) | [inline] |
copy this from a vector
Definition at line 164 of file GLVector.h.
References mathglpp::GLVector2< T >::D, and mathglpp::GLVector2< T >::val.
bool mathglpp::GLVector2< T >::operator== | ( | const GLVector2< T > & | v | ) | [inline] |
Equality check. NB. May not be constant time, depending on memcmp.
Definition at line 168 of file GLVector.h.
References mathglpp::GLVector2< T >::D, and mathglpp::GLVector2< T >::val.
const GLVector2 mathglpp::GLVector2< T >::operator- | ( | ) | const [inline] |
negate this
Definition at line 172 of file GLVector.h.
References mathglpp::GLVector2< T >::GLVector2(), mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Here is the call graph for this function:
const T mathglpp::GLVector2< T >::dot | ( | const GLVector2< T > & | gv | ) | const [inline] |
Get the dot product of this and a vector.
Definition at line 178 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Referenced by mathglpp::GLVector2< T >::projection(), and mathglpp::GLVector2< T >::vectorProjection().
T mathglpp::GLVector2< T >::length | ( | ) | const [inline] |
Get the length of this.
Definition at line 182 of file GLVector.h.
References mathglpp::GLVector2< T >::lengthSqr().
Referenced by mathglpp::GLVector2< T >::normalize(), and mathglpp::GLVector2< T >::unit().
00183 { return sqrt(lengthSqr()); }
Here is the call graph for this function:
T mathglpp::GLVector2< T >::lengthSqr | ( | ) | const [inline] |
Get the length squared, less computation than length().
Definition at line 186 of file GLVector.h.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
Referenced by mathglpp::GLVector2< T >::length().
const GLVector2 mathglpp::GLVector2< T >::unit | ( | ) | const [inline] |
Get the the unit vector of this.
Definition at line 190 of file GLVector.h.
References mathglpp::GLVector2< T >::length().
00191 { 00192 return (*this)/length(); 00193 }
Here is the call graph for this function:
GLVector2& mathglpp::GLVector2< T >::normalize | ( | ) | [inline] |
Normalize this, makes this a unit vector, US spelling.
Definition at line 196 of file GLVector.h.
References mathglpp::GLVector2< T >::length().
00197 { 00198 (*this)/=length(); 00199 return *this; 00200 }
Here is the call graph for this function:
const T mathglpp::GLVector2< T >::projection | ( | const GLVector2< T > & | in | ) | const [inline] |
Get the projection of this and a vector.
Definition at line 203 of file GLVector.h.
References mathglpp::GLVector2< T >::dot().
00204 { return dot(in); }
Here is the call graph for this function:
GLVector2 mathglpp::GLVector2< T >::orthogonalProjection | ( | const GLVector2< T > & | in | ) | const [inline] |
Get the orthogonal projection of this and a vector.
Definition at line 207 of file GLVector.h.
References mathglpp::GLVector2< T >::vectorProjection().
00208 { return in - vectorProjection(in); }
Here is the call graph for this function:
GLVector2 mathglpp::GLVector2< T >::vectorProjection | ( | const GLVector2< T > & | in | ) | const [inline] |
Get the vector projection of this and a vector.
Definition at line 211 of file GLVector.h.
References mathglpp::GLVector2< T >::dot().
Referenced by mathglpp::GLVector2< T >::orthogonalProjection().
00212 { return (*this) * dot(in); }
Here is the call graph for this function:
void mathglpp::GLVector2< GLbyte >::glVertex | ( | ) | const [inline] |
Closest possible fit
Definition at line 85 of file GLVector.cpp.
References mathglpp::GLVector2< T >::x, and mathglpp::GLVector2< T >::y.
union { ... } |
Value array Anonymous union and struct by sebastien bloc (sebastien.bloc@free.fr).