#include <vector3.h>
The three components of the vector; X,Y and Z, are 32bit fixed point numbers with the binary point between bits 15 and 16.
2005-03-01
2006-05-20
Definition at line 69 of file vector3.h.
Public Member Functions | |
| Vector3 () | |
| Vector3 (fix x, fix y, fix z) | |
| IMPORT Vector3 | operator- () const |
| IMPORT Vector3 | operator+ (const Vector3 &vector) const |
| IMPORT Vector3 | operator- (const Vector3 &vector) const |
| IMPORT Vector3 | operator * (fix scalar) const |
| IMPORT Vector3 | operator/ (fix scalar) const |
| IMPORT Vector3 & | operator+= (const Vector3 &vector) |
| IMPORT Vector3 & | operator-= (const Vector3 &vector) |
| IMPORT Vector3 & | operator *= (fix scalar) |
| IMPORT Vector3 & | operator/= (fix scalar) |
| IMPORT bool | operator== (const Vector3 &vector) const |
| bool | operator!= (const Vector3 &vector) const |
| IMPORT fix | DotProduct (const Vector3 &vector) const |
| IMPORT Vector3 | CrossProduct (const Vector3 &vector) const |
| IMPORT ufix | Length () const |
| IMPORT int | CompareLength (ufix length) const |
| IMPORT int | CompareLengths (const Vector3 &vector) const |
| IMPORT uint32_t | LengthSquared (uint32_t &fraction) const |
| IMPORT Vector3 | UnitVector () const |
| IMPORT Vector3 | Normal (const Vector3 &vector) const |
| IMPORT fixangle | Angle (const Vector3 &vector) const |
| IMPORT Vector3 | Normal (const Vector3 &point1, const Vector3 &point2) const |
| IMPORT fixangle | Angle (const Vector3 &point1, const Vector3 &point2) const |
Static Public Member Functions | |
| static IMPORT void | Translate (Vector3 *outVectors, unsigned vectorCount, const Vector3 *inVectors, const Vector3 &offset) |
| static IMPORT void | Scale (Vector3 *outVectors, unsigned vectorCount, const Vector3 *inVectors, fix scale) |
Public Attributes | |
| fix | X |
| fix | Y |
| fix | Z |
Private Member Functions | |
| void | NormaliseComponents (unsigned bits) |
|
|
Constructor which doesn't initialise the vector object. |
|
||||||||||||||||
|
Constructor which initialises the vector object.
|
|
|
Uninary minus operator.
Definition at line 41 of file vector3.cpp. |
|
|
Calculate the sum of this vector and another. The resulting vector is the sum of the individual component values. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 47 of file vector3.cpp. |
|
|
Calculate the difference between this vector and another. The resulting vector is the difference between the individual component values. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 53 of file vector3.cpp. |
|
|
Scalar multiply. The resulting vector is the product of the individual component values of this vector multiplied by the given scalar value. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 59 of file vector3.cpp. |
|
|
Scalar division. The resulting vector is the result of dividing the individual component values of this vector by the given scalar value. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 65 of file vector3.cpp. |
|
|
Add a vector to this one. The result is the sum of the individual component values. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 71 of file vector3.cpp. |
|
|
Subract a vector from this one. The result is the difference between the individual component values. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 80 of file vector3.cpp. |
|
|
Scalar multiply of this vector. Multiply each component of this vector by a scalar value. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 89 of file vector3.cpp. |
|
|
Scalar divide of this vector. Divide each component of this vector by a scalar value. If any component value overflows the range of 32bit fixed point numbers, then the result is undefined.
Definition at line 98 of file vector3.cpp. |
|
|
Equality operator.
Definition at line 107 of file vector3.cpp. |
|
|
Inequality operator.
|
|
|
Calculate the dot product of this vector and a second vector. If any product of two components is greater than 0x2aaa.aaaa then the result is undefined. This limitation can be met if all components, in both vectors, have a magnitude less than 104. (0x68.00000)
Definition at line 113 of file vector3.cpp. |
|
|
Calculate the cross product of this vector and a second vector. If any product of two components is greater than 0x4000.0000 then the result is undefined. This limitation can be met if all components, in both vectors, have a magnitude less than 128. (0x80.00000)
Definition at line 119 of file vector3.cpp. |
|
|
Calculate the length (magnitude) of this vector. Accuracy is limited to 24 significant bits.
Definition at line 139 of file vector3.cpp. |
|
|
Compare the length (magnitude) of this vector with a given value. This is faster than comparing the value returned by Length(). E.g. instead of if(vector.Length()<distance)
if(vector.CompareLength(distance)<0)
Definition at line 174 of file vector3.cpp. |
|
|
Compare the length of this vector with another. This is faster than comparing two values returned by Length(). E.g. instead of if(vector1.Length()<vector2.Length())
if(vector1.CompareLengths(vector2)<0)
Definition at line 204 of file vector3.cpp. |
|
|
Calculate the square of the length of this vector. This is faster than Length() and is useful when comparing a vector length with a constant or pre-calculated value. (Comparing the square of lengths will give the same result as comparing the lengths.)
Definition at line 222 of file vector3.cpp. |
|
|
Calculate the unit vector which lies in the same direction as this vector. I.e. scale this vector so it has a length of 1.0. Rounding inacuracies mean the length of this 'unit' vector will actualy lie in the range 0x0.fffe to 0x1.0000.
Definition at line 317 of file vector3.cpp. |
|
|
Calculate the unit vector which is normal to this vector and a second vector. I.e. the unit vector which is at right angles to both this vector and the second vector; acording to the right-hand rule. Rounding inacuracies mean the length of this 'unit' vector will actualy lie in the range 0x0.fffe to 0x1.0000.
Definition at line 338 of file vector3.cpp. |
|
|
Calculate the angle between this vector and a second vector.
Definition at line 356 of file vector3.cpp. |
|
||||||||||||
|
Calculate the unit vector which is normal to the two vectors formed by (point1 - this) and (point2 - this). I.e. the unit vector which is at right angles to both of these; acording to the right-hand rule. Rounding inacuracies mean the length of this 'unit' vector will actualy lie in the range 0x0.fffe to 0x1.0000.
Definition at line 362 of file vector3.cpp. |
|
||||||||||||
|
Calculate the angle between the two vectors formed by (point1 - this) and (point2 - this).
Definition at line 368 of file vector3.cpp. |
|
||||||||||||||||||||
|
Translate an array of vectors. I.e. add the given offset to each vector in an array.
Definition at line 374 of file vector3.cpp. |
|
||||||||||||||||||||
|
Scale an array of vectors. I.e. perform a scalar multiply on each vector in an array.
Definition at line 391 of file vector3.cpp. |
|
|
Scale the components of this array such that the component with the largest magnitude has its most-significant bit at the given position.
Definition at line 269 of file vector3.cpp. |
|
|
The X component |
|
|
The Y component |
|
|
The Z component |
1.4.4