#include <GLVector.h>
Collaboration diagram for mathglpp::GLVector3< T >:
Definition at line 501 of file GLVector.h.
Public Types | |
enum | { D = 3 } |
typedef T | value_type |
Public Member Functions | |
GLVector3 () | |
Create an uninitialised vector. | |
GLVector3 (const T &v) | |
Create an initialised vector. | |
GLVector3 (const T &a, const T &b, const T &c) | |
Create an initialise vector. | |
GLVector3 (const GLVector3 &gv) | |
Copy a vector. | |
GLVector3 (const T *f) | |
Create a vector from an array. | |
~GLVector3 () | |
Default destructor. | |
void | set (const T &v1, const T &v2, const T &v3) |
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 GLVector3 | operator+ (const GLVector3 &gv) const |
Get the sum of this and a vector. | |
const GLVector3 | operator- (const GLVector3 &gv) const |
Get the difference of this and a vector. | |
const GLVector3 | operator * (const GLVector3 &gv) const |
Get the element-by-element product of this and a vector. | |
const GLVector3 | operator/ (const GLVector3 &gv) const |
Get the element-by-element quota of this and a vector. | |
const GLVector3 | operator * (const T &v) const |
Get the element-by-element product of this and a scalar. | |
const GLVector3 | operator/ (const T &v) const |
Get the element-by-element quota of this and a scalar. | |
GLVector3 & | operator+= (const GLVector3 &gv) |
Add a vector to this. | |
GLVector3 & | operator-= (const GLVector3 &gv) |
Subtract a vector from this. | |
GLVector3 & | operator *= (const T &f) |
Multiply this by a scalar. | |
GLVector3 & | operator/= (const T &f) |
Divide this by a scalar. | |
GLVector3 & | operator= (const GLVector3 &gv) |
copy this from a vector | |
bool | operator== (const GLVector3 &gv) |
Equality check. NB. May not be constant time, depending on memcmp. | |
const GLVector3 | operator- () const |
negate this | |
const T | dot (const GLVector3 &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 GLVector3 | getCross (const GLVector3 &gv) const |
Get the cross-product of this and a vector. | |
GLVector3 & | cross (const GLVector3 &gv) |
Apply the cross-product of this and a vector. | |
const GLVector3 | unit () const |
Get the the unit vector of this. | |
GLVector3 & | normalize () |
Normalize this, makes this a unit vector, US spelling. | |
const T | projection (const GLVector3 &in) const |
Get the projection of this and a vector. | |
GLVector3 | orthogonalProjection (const GLVector3 &in) const |
Get the orthogonal projection of this and a vector. | |
GLVector3 | vectorProjection (const GLVector3 &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<> | |
GLVector3< GLfloat > & | operator/= (const GLfloat &v) |
template<> | |
GLVector3< GLdouble > & | operator/= (const GLdouble &v) |
template<> | |
const GLVector3< GLfloat > | operator/ (const GLfloat &v) const |
template<> | |
const GLVector3< GLdouble > | operator/ (const GLdouble &v) const |
Public Attributes | |
union { | |
T val [D] | |
struct { | |
T x | |
T y | |
T z | |
} | |
}; | |
Value array Anonymous union and struct by sebastien bloc (sebastien.bloc@free.fr). |
anonymous enum |
mathglpp::GLVector3< T >::GLVector3 | ( | ) | [inline] |
Create an uninitialised vector.
Definition at line 508 of file GLVector.h.
Referenced by mathglpp::GLVector3< T >::getCross(), mathglpp::GLVector3< T >::operator *(), mathglpp::GLVector3< T >::operator+(), mathglpp::GLVector3< T >::operator-(), and mathglpp::GLVector3< T >::operator/().
mathglpp::GLVector3< T >::GLVector3 | ( | const T & | v | ) | [inline] |
mathglpp::GLVector3< T >::GLVector3 | ( | const T & | a, | |
const T & | b, | |||
const T & | c | |||
) | [inline] |
mathglpp::GLVector3< T >::GLVector3 | ( | const GLVector3< T > & | gv | ) | [inline] |
Copy a vector.
Definition at line 519 of file GLVector.h.
References mathglpp::GLVector3< T >::D, and mathglpp::GLVector3< T >::val.
mathglpp::GLVector3< T >::GLVector3 | ( | const T * | f | ) | [inline] |
Create a vector from an array.
Definition at line 523 of file GLVector.h.
References mathglpp::GLVector3< T >::D, and mathglpp::GLVector3< T >::val.
mathglpp::GLVector3< T >::~GLVector3 | ( | ) | [inline] |
void mathglpp::GLVector3< T >::set | ( | const T & | v1, | |
const T & | v2, | |||
const T & | v3 | |||
) | [inline] |
element by element initialiser
Definition at line 530 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
T& mathglpp::GLVector3< T >::operator[] | ( | int | ind | ) | [inline] |
element by element accessor
Definition at line 534 of file GLVector.h.
References mathglpp::GLVector3< T >::val.
00535 { return val[ind]; }
mathglpp::GLVector3< T >::operator T * | ( | void | ) | [inline] |
implicit casting to a pointer
Definition at line 538 of file GLVector.h.
References mathglpp::GLVector3< T >::val.
00539 { return val; }
mathglpp::GLVector3< T >::operator const T * | ( | void | ) | const [inline] |
implicit casting to a const pointer
Definition at line 542 of file GLVector.h.
References mathglpp::GLVector3< T >::val.
00543 { return val; }
void mathglpp::GLVector3< T >::glScale | ( | ) | const |
GL interface, glScale().
void mathglpp::GLVector3< T >::glRotate | ( | const T & | ang | ) | const |
GL interface, glRotate().
void mathglpp::GLVector3< T >::glTranslate | ( | ) | const |
GL interface, glTranslate().
void mathglpp::GLVector3< T >::glVertex | ( | ) | const [inline] |
GL interface, glVertex().
Definition at line 552 of file GLVector.h.
References mathglpp::GLVector3< T >::val.
00552 { mathglpp::glVertexv<D,T>(val); }
void mathglpp::GLVector3< T >::glNormal | ( | ) | const |
GL interface, glNormal().
void mathglpp::GLVector3< T >::copyTo | ( | T * | vec | ) | const [inline] |
copy values to a array
Definition at line 557 of file GLVector.h.
References mathglpp::GLVector3< T >::D, and mathglpp::GLVector3< T >::val.
const GLVector3 mathglpp::GLVector3< T >::operator+ | ( | const GLVector3< T > & | gv | ) | const [inline] |
Get the sum of this and a vector.
Definition at line 561 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
const GLVector3 mathglpp::GLVector3< T >::operator- | ( | const GLVector3< T > & | gv | ) | const [inline] |
Get the difference of this and a vector.
Definition at line 567 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
const GLVector3 mathglpp::GLVector3< T >::operator * | ( | const GLVector3< T > & | gv | ) | const [inline] |
Get the element-by-element product of this and a vector.
Definition at line 573 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
const GLVector3 mathglpp::GLVector3< T >::operator/ | ( | const GLVector3< T > & | gv | ) | const [inline] |
Get the element-by-element quota of this and a vector.
Definition at line 579 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
const GLVector3 mathglpp::GLVector3< T >::operator * | ( | const T & | v | ) | const [inline] |
Get the element-by-element product of this and a scalar.
Definition at line 585 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
const GLVector3 mathglpp::GLVector3< T >::operator/ | ( | const T & | v | ) | const [inline] |
Get the element-by-element quota of this and a scalar.
Definition at line 592 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
GLVector3& mathglpp::GLVector3< T >::operator+= | ( | const GLVector3< T > & | gv | ) | [inline] |
Add a vector to this.
Definition at line 598 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
GLVector3& mathglpp::GLVector3< T >::operator-= | ( | const GLVector3< T > & | gv | ) | [inline] |
Subtract a vector from this.
Definition at line 607 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
GLVector3& mathglpp::GLVector3< T >::operator *= | ( | const T & | f | ) | [inline] |
Multiply this by a scalar.
Definition at line 616 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
GLVector3& mathglpp::GLVector3< T >::operator/= | ( | const T & | f | ) | [inline] |
Divide this by a scalar.
Definition at line 625 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
GLVector3& mathglpp::GLVector3< T >::operator= | ( | const GLVector3< T > & | gv | ) | [inline] |
copy this from a vector
Definition at line 634 of file GLVector.h.
References mathglpp::GLVector3< T >::D, and mathglpp::GLVector3< T >::val.
bool mathglpp::GLVector3< T >::operator== | ( | const GLVector3< T > & | gv | ) | [inline] |
Equality check. NB. May not be constant time, depending on memcmp.
Definition at line 638 of file GLVector.h.
References mathglpp::GLVector3< T >::D, and mathglpp::GLVector3< T >::val.
const GLVector3 mathglpp::GLVector3< T >::operator- | ( | ) | const [inline] |
negate this
Definition at line 642 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Here is the call graph for this function:
const T mathglpp::GLVector3< T >::dot | ( | const GLVector3< T > & | gv | ) | const [inline] |
Get the dot product of this and a vector.
Definition at line 648 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Referenced by mathglpp::GLPlane< T >::distanceToPoint(), mathglpp::GLPlane< T >::GLPlane(), mathglpp::GLPlane< T >::intersectionWithLine(), mathglpp::GLVector3< T >::orthogonalProjection(), mathglpp::GLPlane< T >::pointProjectionMatrix(), mathglpp::GLVector3< T >::projection(), mathglpp::GLPlane< T >::set(), and mathglpp::GLVector3< T >::vectorProjection().
T mathglpp::GLVector3< T >::length | ( | ) | const [inline] |
Get the length of this.
Definition at line 652 of file GLVector.h.
References mathglpp::GLVector3< T >::lengthSqr().
Referenced by mathglpp::GLVector3< T >::normalize(), and mathglpp::GLVector3< T >::unit().
00653 { return sqrt(lengthSqr()); }
Here is the call graph for this function:
T mathglpp::GLVector3< T >::lengthSqr | ( | ) | const [inline] |
Get the length squared, less computation than length().
Definition at line 656 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Referenced by mathglpp::GLVector3< T >::length().
const GLVector3 mathglpp::GLVector3< T >::getCross | ( | const GLVector3< T > & | gv | ) | const [inline] |
Get the cross-product of this and a vector.
Definition at line 660 of file GLVector.h.
References mathglpp::GLVector3< T >::GLVector3(), mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
Referenced by mathglpp::GLPlane< T >::set().
Here is the call graph for this function:
GLVector3& mathglpp::GLVector3< T >::cross | ( | const GLVector3< T > & | gv | ) | [inline] |
Apply the cross-product of this and a vector.
Definition at line 666 of file GLVector.h.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
00667 { 00668 T temp[] = { x, y, z }; 00669 00670 x = temp[1] * gv.z - temp[2] * gv.y; 00671 y = temp[2] * gv.x - temp[0] * gv.z; 00672 z = temp[0] * gv.y - temp[1] * gv.x; 00673 00674 return *this; 00675 }
const GLVector3 mathglpp::GLVector3< T >::unit | ( | ) | const [inline] |
Get the the unit vector of this.
Definition at line 678 of file GLVector.h.
References mathglpp::GLVector3< T >::length().
Referenced by mathglpp::GLQuaternion< T >::GLQuaternion().
00679 { 00680 return (*this)/length(); 00681 }
Here is the call graph for this function:
GLVector3& mathglpp::GLVector3< T >::normalize | ( | ) | [inline] |
Normalize this, makes this a unit vector, US spelling.
Definition at line 684 of file GLVector.h.
References mathglpp::GLVector3< T >::length().
Referenced by mathglpp::GLPlane< T >::GLPlane(), and mathglpp::GLPlane< T >::set().
00685 { 00686 (*this)/=length(); 00687 return *this; 00688 }
Here is the call graph for this function:
const T mathglpp::GLVector3< T >::projection | ( | const GLVector3< T > & | in | ) | const [inline] |
Get the projection of this and a vector.
Definition at line 691 of file GLVector.h.
References mathglpp::GLVector3< T >::dot().
00692 { return dot(in); }
Here is the call graph for this function:
GLVector3 mathglpp::GLVector3< T >::orthogonalProjection | ( | const GLVector3< T > & | in | ) | const [inline] |
Get the orthogonal projection of this and a vector.
Definition at line 695 of file GLVector.h.
References mathglpp::GLVector3< T >::dot().
00696 { return in - (*this) * dot(in); }
Here is the call graph for this function:
GLVector3 mathglpp::GLVector3< T >::vectorProjection | ( | const GLVector3< T > & | in | ) | const [inline] |
Get the vector projection of this and a vector.
Definition at line 699 of file GLVector.h.
References mathglpp::GLVector3< T >::dot().
00700 { return (*this) * dot(in); }
Here is the call graph for this function:
void mathglpp::GLVector3< GLbyte >::glVertex | ( | ) | const [inline] |
Closest possible fit
Definition at line 139 of file GLVector.cpp.
References mathglpp::GLVector3< T >::x, mathglpp::GLVector3< T >::y, and mathglpp::GLVector3< T >::z.
union { ... } |
Value array Anonymous union and struct by sebastien bloc (sebastien.bloc@free.fr).