|
QSDK 1.1 Documentation |
#include <Q/maths.h>
Public Member Functions | |
| Vec3 () | |
| Create a new uninitialised vector. | |
| Vec3 (T v) | |
| Create a vector with all elements initialised to the same value. | |
| Vec3 (T tx, T ty, T tz) | |
| Create a vector from three existing values. | |
| Vec3 (const Vec2< T > &v) | |
| Convert a two element vector to a new three element vector. | |
| Vec3 (const Vec4< T > &v) | |
| Convert a four element vector to a new three 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< T > & | vec2 () |
| Cast a three element vector to a two element vector. | |
| const Vec2< T > & | vec2 () const |
| Cast a three element vector to a two element vector. | |
| bool | isZero () const |
| Test the value of a vector. | |
| Vec3 & | operator+= (const Vec3 &v) |
| Calculate the sum of two vectors. | |
| Vec3 & | operator-= (const Vec3 &v) |
| Calculate the difference of two vectors. | |
| Vec3 & | operator *= (const Vec3 &v) |
| Calculate the elementwise product of two vectors. | |
| Vec3 & | operator/= (const Vec3 &v) |
| Calculate the ratio of two vectors. | |
| Vec3 & | operator *= (T s) |
| Calculate a scalar multiple of a vector. | |
| Vec3 & | operator/= (T s) |
| Calculate a scalar ratio of a vector. | |
| int | operator== (const T &i) const |
| Compare two vectors. | |
| int | operator!= (const T &i) const |
| Compare two vectors. | |
| T | modulus () const |
| Calculate the length of a vector. | |
| T | length () const |
| Calculate the length of a vector. | |
| T | lengthSquared () const |
| Calculate the square of the length of a vector. | |
| T | distanceTo (const Vec3 &v) const |
| Calculate the distance between two points. | |
| T | distanceToSquared (const Vec3 &there) const |
| Calculate the square of the distance between two points. | |
| bool | equals (const Vec3 &v, T e=Epsilon) const |
| Compare two vectors. | |
| bool | equal (const Vec3 &v, T e=Epsilon) const |
| Compare two vectors. | |
| void | normalize () |
| Normalize the vector. | |
| Vec3 & | scaleTo (T newlen) |
| Set the length of a vector. | |
| void | zero () |
| Zero a vector. | |
| void | clamp (const T min, const T max) |
| Constrain a vector to a range. | |
| Vec3 & | sub (const Vec3 &a, const Vec3 &b) |
| Calculate the difference of two vectors. | |
| Vec3 & | add (const Vec3 &a, const Vec3 &b) |
| Calculate the sum of two vectors. | |
| Vec3 & | negate () |
| Negate a vector. | |
| Vec3 & | product (const Vec3 &a, const Vec3 &b) |
| Calculate the product of two vectors. | |
| Vec3 & | product (const Vec3 &a, float b) |
| Calculate the scalar product of a vector. | |
| Vec3 & | cross (const Vec3 &v1, const Vec3 &v2) |
| Calculate the cross (or outer) product of two vectors. | |
| T | dot (const Vec3 &b) const |
| Calculate the inner product of two vectors. | |
| void | setNormalTo (const Vec3 &v) |
| Calculate some vector normal to a vector. | |
| Vec3 | rotate (const Matrix4f &m) const |
| Calculate the product of a vector and a matrix. | |
| Vec3 | rotate (const Affine4f &m) const |
| Calculate the product of a vector and a matrix. | |
| Vec3 | transform (const Matrix4f &m) const |
| Calculate the product of a vector and a matrix. | |
| Vec3 | transform (const Affine4f &m) const |
| Calculate the product of a vector and a matrix. | |
| Vec3 | inverseRotate (const Matrix4f &m) const |
| Calculate the product of a vector and a matrix. | |
| Vec3 | inverseTransform (const Matrix4f &m) const |
| Calculate the product of a vector and a matrix. | |
Static Public Member Functions | |
| const Vec3 & | origin () |
| The vector representing the origin. | |
| const Vec3 & | xAxis () |
| The vector representing the X axis. | |
| const Vec3 & | yAxis () |
| The vector representing the Y axis. | |
| const Vec3 & | zAxis () |
| The vector representing the Z axis. | |
Public Attributes | |
| T | x |
| The first element of the vector. | |
| T | y |
| The second element of the vector. | |
| T | z |
| The third element of the vector. | |
Friends | |
| Vec3 | operator+ (const Vec3< T > &v) |
| Return a copy of a vector. | |
| Vec3 | operator- (const Vec3 &v) |
| Negate a vector. | |
| Vec3 | operator+ (const Vec3 &v1, const Vec3 &v2) |
| Calculate the sum of two vectors. | |
| Vec3 | operator- (const Vec3 &v1, const Vec3 &v2) |
| Calculate the difference of two vectors. | |
| Vec3 | operator * (const Vec3 &v1, const Vec3 &v2) |
| Calculate the elementwise product of two vectors. | |
| Vec3 | operator * (const Vec3 &v, T s) |
| Calculate a scalar multiple of a vector. | |
| Vec3 | operator * (T s, const Vec3 &v) |
| Calculate a scalar multiple of a vector. | |
| Vec3 | operator * (const Vec3 &v, const Matrix4f &m) |
| Calculate the product of a vector and a matrix. | |
| Vec3 | operator * (const Vec3 &v, const Matrix3f &m) |
| Calculate the product of a vector and a matrix. | |
| Vec3 | operator * (const Matrix3f &m, const Vec3 &v) |
| Calculate the product of a vector and a matrix. | |
| Vec3 | operator/ (const Vec3 &v1, const Vec3 &v2) |
| Calculate the elementwise quotient of two vectors. | |
| Vec3 | operator/ (const Vec3 &v, T s) |
| Calculate a scalar quotient of a vector. | |
| Vec3 | operator/ (T s, const Vec3 &v) |
| Calculate the elementwise quotient of a vector and a scalar. | |
| Vec3 | operator/ (const Vec3 &v, const Matrix4f &m) |
| Calculate the product of a vector and a matrix. | |
| Vec3 | operator^ (const Vec3 &v1, const Vec3 &v2) |
| Vec3 | cross (const Vec3 &v1, const Vec3 &v2) |
| Calculate the cross (or outer) product of two vectors. | |
| T | dot (const Vec3 &v1, const Vec3 &v2) |
| Calculate the inner product of two vectors. | |
| Vec3 | reflect (const Vec3 &n, const Vec3 &i) |
| Calculate a reflection vector. | |
| Vec3 | refract (const Vec3 &n, const Vec3 &i, T indexRatio) |
| Calculate a refraction vector. | |
| Vec3 | interpolate (T mul, const Vec3 &v1, const Vec3 &v2) |
| Interpolate between two vectors. | |
| bool | operator< (const Vec3 &v1, const Vec3 &v2) |
| Compare two vectors. | |
| bool | operator<= (const Vec3 &v1, const Vec3 &v2) |
| Compare two vectors. | |
| bool | operator== (const Vec3 &v1, const Vec3 &v2) |
| Compare two vectors. | |
| bool | operator!= (const Vec3 &v1, const Vec3 &v2) |
| Compare two vectors. | |
Instantiate this template using an arithmetic type of the required precision. Various common types of three element vectors are pre-defined as templates (e.g. Vec3f, Vec3d, Vec3i).
|
||||||||||
|
Convert a two element vector to a new three element vector. The first two elements of the new vector are initialised to the two elements of the existing vector and the third is set to zero. |
|
||||||||||
|
Convert a four element vector to a new three element vector. The three elements of the new vector are initialised to the first three elements of the existing vector divided by its fourth element |
|
||||||||||||||||
|
Calculate the sum of two vectors. Set the value of each element of this vector to the sum of the corresponding elements of a and b.
|
|
||||||||||||||||
|
Constrain a vector to a range. Set each element of the vector to the result of calling Maths::clamp with that element and the values min and max. |
|
||||||||||||||||
|
Calculate the cross (or outer) product of two vectors. Set this vector to a vector which is normal to both v1 and v2, scaled by the product of the lengths of both v1 and v2 and the sine of the angle between them.
|
|
||||||||||
|
Calculate the distance between two points.
|
|
||||||||||
|
Calculate the square of the distance between two points.
|
|
||||||||||
|
Calculate the inner product of two vectors.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||
|
Calculate the product of a vector and a matrix.
|
|
|||||||||
|
Test the value of a vector.
|
|
|||||||||
|
Calculate the length of a vector.
|
|
|||||||||
|
Calculate the square of the length of a vector.
|
|
|||||||||
|
Calculate the length of a vector.
|
|
|||||||||
|
Negate a vector. Negate each element of the vector.
|
|
|
Normalize the vector. Normalize the vector by dividing each element by the vector's modulus.
|
|
||||||||||
|
Calculate a scalar multiple of a vector. Set the value of each element of this vector to the product of that element and s.
|
|
||||||||||
|
Calculate the elementwise product of two vectors. Set the value of each element of this vector to the product of that element and the corresponding element of v.
|
|
||||||||||
|
Compare two vectors.
|
|
||||||||||
|
Calculate the sum of two vectors. Set the value of each element of this vector to the sum of that element and the corresponding element of v.
|
|
||||||||||
|
Calculate the difference of two vectors. Set the value of each element of this vector to the difference of that element and the corresponding element of v.
|
|
||||||||||
|
Calculate a scalar ratio of a vector. Set the value of each element of this vector to the ratio of that element and s.
|
|
||||||||||
|
Calculate the ratio of two vectors. Set the value of each element of this vector to the ratio of that element and the corresponding element of v.
|
|
||||||||||
|
Compare two vectors.
|
|
||||||||||
|
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 scalar product of a vector. Set the value of each element of this vector to the product of the corresponding element of a and b.
|
|
||||||||||||||||
|
Calculate the product of two vectors. Set the value of each element of this vector to the product of the corresponding elements of a and b.
|
|
||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||
|
Set the length of a vector. Normalize the vector and then scale each element by newlen.
|
|
||||||||||
|
Calculate some vector normal to a vector. Set this vector to a vector which is normal to v. |
|
||||||||||||||||
|
Calculate the difference of two vectors. Set the value of each element of this vector to the difference of the corresponding elements of a and b.
|
|
||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||
|
Calculate the product of a vector and a matrix.
|
|
|||||||||
|
Cast a three element vector to a two element vector.
|
|
|||||||||
|
Cast a three element vector to a two element vector.
|
|
|||||||||
|
The vector representing the X axis.
|
|
|||||||||
|
The vector representing the Y axis.
|
|
|||||||||
|
The vector representing the Z 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.
|
|
||||||||||||||||||||
|
Interpolate between two vectors.
|
|
||||||||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||||||||
|
Calculate a scalar multiple of a vector.
|
|
||||||||||||||||
|
Calculate a scalar multiple of a vector.
|
|
||||||||||||||||
|
Calculate the elementwise product of two vectors.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
||||||||||||||||
|
Calculate the sum of two vectors.
|
|
||||||||||||||||
|
Calculate the difference of two vectors.
|
|
||||||||||
|
Negate a vector.
|
|
||||||||||||||||
|
Calculate the product of a vector and a matrix.
|
|
||||||||||||||||
|
Calculate the elementwise quotient of a vector and a scalar.
|
|
||||||||||||||||
|
Calculate a scalar quotient of a vector.
|
|
||||||||||||||||
|
Calculate the elementwise quotient of two vectors.
|
|
||||||||||||||||
|
Compare two vectors.
This operator performs elementwise comparison of the two vectors. Each element is compared in turn, starting with the first element. If the element of v1 is less than the corresponding element of v2,
|
|
||||||||||||||||
|
Compare two vectors.
|
|
||||||||||||||||
|
Compare two vectors.
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Calculate a reflection vector.
|
|
||||||||||||||||||||
|
Calculate a refraction vector.
|
|
|
|
Qube Software Limited © 2000-2004
|
|