|
QSDK 1.1 Documentation |
#include <Q/maths.h>
Public Member Functions | |
| Vec2 () | |
| Create a new uninitialised vector. | |
| Vec2 (const Vec2 &v) | |
| Create a copy of an existing vector. | |
| Vec2 (T tx, T ty) | |
| Create a vector from two existing values. | |
| Vec2 (T val) | |
| Create a vector with both elements initialised to the same value. | |
| Vec2 (const Vec3< T > &v) | |
| Convert a three element vector to a new two element vector. | |
| Vec2 (const Vec4< T > &v) | |
| Convert a four element vector to a new two element vector. | |
| T & | operator[] (unsigned int i) |
| Return a reference to some element of the vector. | |
| const T & | operator[] (unsigned int i) const |
| Return a reference to some element of the vector. | |
| Vec2 | operator- () const |
| Negate each element of the vector. | |
| bool | isZero () const |
| Test the value of a vector. | |
| bool | equals (const Vec2 &v, float e=Epsilon) const |
| Compare two vectors. | |
| void | normalize () |
| Normalise the vector. | |
| void | zero () |
| Zero a vector. | |
| Vec2 & | negate () |
| Negate a vector. | |
| Vec2 & | product (const Vec2 &v, float s) |
| Calculate the product of a vector and a floating point value. | |
| T | modulus () |
| Calculate the length of a vector. | |
| T | dot (const Vec2 &b) const |
| Calculate the inner product of two vectors. | |
Static Public Member Functions | |
| const Vec2 & | origin () |
| The vector representing the origin. | |
| const Vec2 & | xAxis () |
| The vector representing the X axis. | |
| const Vec2 & | yAxis () |
| The vector representing the Y axis. | |
Public Attributes | |
| T | x |
| The first element of the vector. | |
| T | y |
| The second element of the vector. | |
Friends | |
| Vec2 | operator+ (const Vec2 &v1, const Vec2 &v2) |
| Calculate the sum of two vectors. | |
| Vec2 | operator- (const Vec2 &v1, const Vec2 &v2) |
| Calculate the difference of two vectors. | |
| Vec2 | operator * (const Vec2 &v1, const Vec2 &v2) |
| Calculate the elementwise product of two vectors. | |
| Vec2 | operator * (const Vec2 &v, T s) |
| Calculate a scalar multiple of a vector. | |
| Vec2 | operator * (T s, const Vec2 &v) |
| Calculate a scalar multiple of a vector. | |
| Vec2 | operator/ (const Vec2 &v1, const Vec2 &v2) |
| Calculate the quotient of two vectors. | |
| Vec2 | operator/ (const Vec2 &v, T s) |
| Calculate a scalar quotient of a vector. | |
| Vec2 | operator/ (T s, const Vec2 &v) |
| Calculate a scalar quotient of a vector. | |
| Vec2 & | operator+= (Vec2 &a, const Vec2 &s) |
| Calculate the sum of two vectors. | |
| Vec2 & | operator-= (Vec2 &a, const Vec2 &s) |
| Calculate the difference of two vectors. | |
| Vec2 & | operator *= (Vec2 &a, const Vec2 &s) |
| Calculate the elementwise product of two vectors. | |
| Vec2 & | operator *= (Vec2 &a, T s) |
| Calculate the scalar product of two vectors. | |
| Vec2 & | operator/= (Vec2 &a, const Vec2 &v) |
| Calculate the quotient of two vectors. | |
| Vec2 & | operator/= (Vec2 &a, T s) |
| Calculate a scalar quotient of a vector. | |
| bool | operator== (const Vec2 &v1, const Vec2 &v2) |
| Compare two vectors. | |
| bool | operator!= (const Vec2 &v1, const Vec2 &v2) |
| Compare two vectors. | |
| T | cross (const Vec2 &v1, const Vec2 &v2) |
| Calculate the cross (or outer) product of two vectors. | |
| T | dot (const Vec2 &v1, const Vec2 &v2) |
| Calculate the inner product of two vectors. | |
Instantiate this template using an arithmetic type of the required precision. Various common types of two element vectors are pre-defined as templates (e.g. Vec2f, Vec2d, Vec2i).
|
||||||||||
|
Convert a three element vector to a new two element vector. The two elements of the new vector are initialised to the first two elements of the existing vector |
|
||||||||||
|
Convert a four element vector to a new two element vector. The two elements of the new vector are initialised to the first two elements of the existing vector divided by its fourth element |
|
||||||||||
|
Calculate the inner product of two vectors.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
|||||||||
|
Test the value of a vector.
|
|
|||||||||
|
Calculate the length of a vector.
|
|
|||||||||
|
Negate a vector. Negate each element of the vector.
|
|
|||||||||
|
Normalise the vector. Normalise the vector by dividing each element by the vector's modulus.
|
|
|||||||||
|
Negate each element of the vector.
|
|
||||||||||
|
Return a reference to some element of the vector.
|
|
||||||||||
|
Return a reference to some element of the vector.
|
|
|||||||||
|
The vector representing the origin.
|
|
||||||||||||||||
|
Calculate the product of a vector and a floating point value. Set each element of this vector to the product of the corresponding element of v and s.
|
|
|||||||||
|
The vector representing the X axis.
|
|
|||||||||
|
The vector representing the Y axis.
|
|
|||||||||
|
Zero a vector. Set each element of the vector to zero. |
|
||||||||||||||||
|
Calculate the cross (or outer) product of two vectors.
|
|
||||||||||||||||
|
Calculate the inner product of two vectors.
|
|
||||||||||||||||
|
Calculate a scalar multiple of a vector.
|
|
||||||||||||||||
|
Calculate a scalar multiple of a vector.
|
|
||||||||||||||||
|
Calculate the elementwise product of two vectors.
|
|
||||||||||||||||
|
Calculate the scalar product of two vectors. Set the value of each element of a to the product of the corresponding elements of a and s.
|
|
||||||||||||||||
|
Calculate the elementwise product of two vectors. Set the value of each element of a to the product of the corresponding elements of a and s.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
||||||||||||||||
|
Calculate the sum of two vectors.
|
|
||||||||||||||||
|
Calculate the sum of two vectors. Set the value of each element of a to the sum of the corresponding elements of a and s.
|
|
||||||||||||||||
|
Calculate the difference of two vectors.
|
|
||||||||||||||||
|
Calculate the difference of two vectors. Set the value of each element of a to the sum of the corresponding elements of a and s.
|
|
||||||||||||||||
|
Calculate a scalar quotient of a vector.
|
|
||||||||||||||||
|
Calculate a scalar quotient of a vector.
|
|
||||||||||||||||
|
Calculate the quotient of two vectors.
|
|
||||||||||||||||
|
Calculate a scalar quotient of a vector. Set the value of each element of the vector to the quotient of the corresponding elements of a and s.
|
|
||||||||||||||||
|
Calculate the quotient of two vectors. Set the value of each element of the vector to the quotient of the corresponding elements of a and v.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
|
|
Qube Software Limited © 2000-2004
|
|