![]() |
Public API Reference |
#include <vector3.h>
Public Methods | |
csVector3 () | |
Make a new vector. More... | |
csVector3 (float m) | |
Make a new initialized vector. More... | |
csVector3 (float ix, float iy, float iz=0) | |
Make a new vector and initialize with the given values. More... | |
csVector3 (const csVector3 &v) | |
Copy Constructor. More... | |
csVector3 (const csDVector3 &) | |
Conversion from double precision vector to single. More... | |
void | Cross (const csVector3 &px, const csVector3 &py) |
Take cross product of two vectors and put result in this vector. More... | |
float | operator[] (int n) const |
Returns n-th component of the vector. More... | |
float & | operator[] (int n) |
Returns n-th component of the vector. More... | |
csVector3 & | operator+= (const csVector3 &v) |
Add another vector to this vector. More... | |
csVector3 & | operator-= (const csVector3 &v) |
Subtract another vector from this vector. More... | |
csVector3 & | operator *= (float f) |
Multiply this vector by a scalar. More... | |
csVector3 & | operator/= (float f) |
Divide this vector by a scalar. More... | |
csVector3 | operator+ () const |
Unary + operator. More... | |
csVector3 | operator- () const |
Unary - operator. More... | |
void | Set (float sx, float sy, float sz) |
Set the value of this vector. More... | |
void | Set (const csVector3 &v) |
Set the value of this vector. More... | |
float | Norm () const |
Returns the norm of this vector. More... | |
float | SquaredNorm () const |
Return the squared norm (magnitude) of this vector. More... | |
csVector3 | Unit () const |
Returns the unit vector in the direction of this vector. More... | |
void | Normalize () |
Scale this vector to length = 1.0;. More... | |
bool | IsZero (float precision=SMALL_EPSILON) const |
Query if the vector is zero. More... | |
Static Public Methods | |
float | Norm (const csVector3 &v) |
Returns the norm (magnitude) of a vector. More... | |
csVector3 | Unit (const csVector3 &v) |
Normalizes a vector to a unit vector. More... | |
Public Attributes | |
float | x |
The X component of the vector. More... | |
float | y |
The Y component of the vector. More... | |
float | z |
The Z component of the vector. More... | |
Friends | |
csVector3 | operator+ (const csVector3 &v1, const csVector3 &v2) |
Add two vectors. More... | |
csDVector3 | operator+ (const csDVector3 &v1, const csVector3 &v2) |
Add two vectors of differing type, raise the csVector3 to DVector3. More... | |
csDVector3 | operator+ (const csVector3 &v1, const csDVector3 &v2) |
Add two vectors of differing type, raise the csVector3 to DVector3. More... | |
csVector3 | operator- (const csVector3 &v1, const csVector3 &v2) |
Subtract two vectors. More... | |
csDVector3 | operator- (const csVector3 &v1, const csDVector3 &v2) |
Subtract two vectors of differing type, cast to double. More... | |
csDVector3 | operator- (const csDVector3 &v1, const csVector3 &v2) |
Subtract two vectors of differing type, cast to double. More... | |
float | operator * (const csVector3 &v1, const csVector3 &v2) |
Take the dot product of two vectors. More... | |
csVector3 | operator% (const csVector3 &v1, const csVector3 &v2) |
Take the cross product of two vectors. More... | |
csVector3 | operator * (const csVector3 &v, float f) |
Multiply a vector and a scalar. More... | |
csVector3 | operator * (float f, const csVector3 &v) |
Multiply a vector and a scalar. More... | |
csDVector3 | operator * (const csVector3 &v, double f) |
Multiply a vector and a scalar double. Upgrade v to DVector. More... | |
csDVector3 | operator * (double f, const csVector3 &v) |
Multiply a vector and a scalar double. Upgrade v to DVector. More... | |
csVector3 | operator * (const csVector3 &v, int f) |
Multiply a vector and a scalar int. More... | |
csVector3 | operator * (int f, const csVector3 &v) |
Multiply a vector and a scalar int. More... | |
csVector3 | operator/ (const csVector3 &v, float f) |
Divide a vector by a scalar. More... | |
csDVector3 | operator/ (const csVector3 &v, double f) |
Divide a vector by a scalar double. Upgrade v to DVector. More... | |
csVector3 | operator/ (const csVector3 &v, int f) |
Divide a vector by a scalar int. More... | |
bool | operator== (const csVector3 &v1, const csVector3 &v2) |
Check if two vectors are equal. More... | |
bool | operator!= (const csVector3 &v1, const csVector3 &v2) |
Check if two vectors are not equal. More... | |
csVector3 | operator>> (const csVector3 &v1, const csVector3 &v2) |
Project one vector onto another. More... | |
csVector3 | operator<< (const csVector3 &v1, const csVector3 &v2) |
Project one vector onto another. More... | |
bool | operator< (const csVector3 &v, float f) |
Test if each component of a vector is less than a small epsilon value. More... | |
bool | operator> (float f, const csVector3 &v) |
Test if each component of a vector is less than a small epsilon value. More... |
Definition at line 38 of file vector3.h.
|
Make a new vector. The vector is not initialized. This makes the code slightly faster as csVector3 objects are used a lot. Definition at line 53 of file vector3.h. Referenced by operator-. |
|
Make a new initialized vector. Creates a new vector and initializes it to m*<1,1,1>. To create a vector initialized to the zero vector, use csVector3(0) |
|
Make a new vector and initialize with the given values.
|
|
Copy Constructor.
|
|
Conversion from double precision vector to single.
|
|
Take cross product of two vectors and put result in this vector.
|
|
Query if the vector is zero.
|
|
Returns the norm (magnitude) of a vector.
Definition at line 236 of file vector3.h. References Norm. |
|
Returns the norm of this vector.
Referenced by Norm, csPlane3::Normalize, and Unit. |
|
Scale this vector to length = 1.0;.
|
|
Multiply this vector by a scalar.
|
|
Unary + operator.
|
|
Add another vector to this vector.
|
|
Unary - operator.
|
|
Subtract another vector from this vector.
|
|
Divide this vector by a scalar.
|
|
Returns n-th component of the vector.
|
|
Returns n-th component of the vector.
|
|
Set the value of this vector.
|
|
Set the value of this vector.
Definition at line 216 of file vector3.h. Referenced by csSphere::csSphere. |
|
Return the squared norm (magnitude) of this vector.
|
|
Normalizes a vector to a unit vector.
Definition at line 239 of file vector3.h. References Unit. |
|
Returns the unit vector in the direction of this vector. Attempting to normalize a zero-vector will result in a divide by zero error. This is as it should be... fix the calling code. Definition at line 233 of file vector3.h. References Norm. Referenced by Unit. |
|
Multiply a vector and a scalar int.
|
|
Multiply a vector and a scalar int.
|
|
Multiply a vector and a scalar double. Upgrade v to DVector.
|
|
Multiply a vector and a scalar double. Upgrade v to DVector.
|
|
Multiply a vector and a scalar.
|
|
Multiply a vector and a scalar.
|
|
Take the dot product of two vectors.
|
|
Check if two vectors are not equal.
|
|
Take the cross product of two vectors.
|
|
Add two vectors of differing type, raise the csVector3 to DVector3.
|
|
Add two vectors of differing type, raise the csVector3 to DVector3.
|
|
Add two vectors.
|
|
Subtract two vectors of differing type, cast to double.
|
|
Subtract two vectors of differing type, cast to double.
|
|
Subtract two vectors.
|
|
Divide a vector by a scalar int.
|
|
Divide a vector by a scalar double. Upgrade v to DVector.
|
|
Divide a vector by a scalar.
|
|
Test if each component of a vector is less than a small epsilon value.
|
|
Project one vector onto another.
|
|
Check if two vectors are equal.
|
|
Test if each component of a vector is less than a small epsilon value.
|
|
Project one vector onto another.
|
|
|
|