csVector4T< T > Class Template Reference
[Geometry utilities]
A 4D vector with variable type components.
More...
#include <csgeom/vector4.h>
Public Member Functions | |
void | Cross (const csVector4T &v1, const csVector4T &v2) |
Take cross product of two vectors and put result in this vector. | |
csVector4T (const csVector3 &v) | |
Convert from a three-component vector. w is set to 1. | |
csVector4T (const csVector4T &v) | |
Copy Constructor. | |
csVector4T (const T &ix, const T &iy, const T &iz=T(0), const T &iw=T(1)) | |
Make a new vector and initialize with the given values. | |
csVector4T (const T &m) | |
Make a new initialized vector. | |
csVector4T () | |
Make a new vector. | |
csString | Description () const |
Return a textual representation of the vector in the form "x,y,z,w". | |
void | Get (T *v) |
Get the value of this vector. | |
bool | IsZero (T precision=SMALL_EPSILON) const |
Query if the vector is zero. | |
T | Norm () const |
Returns the norm of this vector. | |
void | Normalize () |
Scale this vector to length = 1.0;. | |
csVector4T & | operator *= (T f) |
Multiply this vector by a scalar. | |
csVector4T | operator+ () const |
Unary + operator. | |
csVector4T & | operator+= (const csVector4T &v) |
Add another vector to this vector. | |
csVector4T | operator- () const |
Unary - operator. | |
csVector4T & | operator-= (const csVector4T &v) |
Subtract another vector from this vector. | |
csVector4T & | operator/= (T f) |
Divide this vector by a scalar. | |
template<typename T2> | |
csVector4T & | operator= (const csVector4T< T2 > &other) |
Assignment operator. | |
float & | operator[] (int n) |
Returns n-th component of the vector. | |
float | operator[] (int n) const |
Returns n-th component of the vector. | |
void | Set (T v) |
Set the value of this vector so that all components are the same. | |
void | Set (T const *v) |
Set the value of this vector. | |
void | Set (csVector4T const &v) |
Set the value of this vector. | |
void | Set (T sx, T sy, T sz, T sw) |
Set the value of this vector. | |
T | SquaredNorm () const |
Return the squared norm (magnitude) of this vector. | |
csVector4T | Unit () const |
Returns the unit vector in the direction of this vector. | |
Static Public Member Functions | |
static T | Norm (const csVector4T &v) |
Returns the norm (magnitude) of a vector. | |
static csVector4T | Unit (const csVector4T &v) |
Normalizes a vector to a unit vector. | |
Friends | |
csVector4T | operator * (int f, const csVector4T &v) |
Multiply a vector and a scalar int. | |
csVector4T | operator * (const csVector4T &v, int f) |
Multiply a vector and a scalar int. | |
csVector4T | operator * (float f, const csVector4T &v) |
Multiply a vector and a scalar. | |
csVector4T | operator * (const csVector4T &v, T f) |
Multiply a vector and a scalar. | |
float | operator * (const csVector4T &v1, const csVector4T &v2) |
Take the dot product of two vectors. | |
bool | operator!= (const csVector4T &v1, const csVector4T &v2) |
Check if two vectors are not equal. | |
csVector4T | operator% (const csVector4T &v1, const csVector4T &v2) |
Take the cross product of two vectors. | |
csVector4T | operator+ (const csVector4T &v1, const csVector4T &v2) |
Add two vectors. | |
csVector4T | operator- (const csVector4T &v1, const csVector4T &v2) |
Subtract two vectors. | |
csVector4T | operator/ (const csVector4T &v, int f) |
Divide a vector by a scalar int. | |
csVector4T | operator/ (const csVector4T &v, T f) |
Divide a vector by a scalar. | |
bool | operator< (const csVector4T &v, float f) |
Test if each component of a vector is less than a small epsilon value. | |
csVector4T | operator<< (const csVector4T &v1, const csVector4T &v2) |
Project one vector onto another. | |
bool | operator== (const csVector4T &v1, const csVector4T &v2) |
Check if two vectors are equal. | |
bool | operator> (float f, const csVector4T &v) |
Test if each component of a vector is less than a small epsilon value. | |
csVector4T | operator>> (const csVector4T &v1, const csVector4T &v2) |
Project one vector onto another. |
Detailed Description
template<typename T>
class csVector4T< T >
A 4D vector with variable type components.
Definition at line 40 of file vector4.h.
Constructor & Destructor Documentation
|
Make a new vector. The vector is not initialized. This makes the code slightly faster. |
|
Make a new initialized vector. Creates a new vector and initializes it to m*<1,1,1,1>. To create a vector initialized to the zero vector, use csVector4(0) |
|
Make a new vector and initialize with the given values.
|
|
Copy Constructor.
|
|
Convert from a three-component vector. w is set to 1.
|
Member Function Documentation
|
Take cross product of two vectors and put result in this vector.
|
|
Return a textual representation of the vector in the form "x,y,z,w".
|
|
Get the value of this vector.
|
|
Query if the vector is zero.
|
|
Returns the norm (magnitude) of a vector.
|
|
Returns the norm of this vector.
Definition at line 264 of file vector4.h. Referenced by csVector4T< float >::Norm(), and csVector4T< float >::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.
|
|
Assignment operator.
|
|
Returns n-th component of the vector.
|
|
Returns n-th component of the vector.
|
|
Set the value of this vector so that all components are the same.
|
|
Set the value of this vector.
|
|
Set the value of this vector.
|
|
Set the value of this vector.
|
|
Return the squared norm (magnitude) of this vector.
|
|
Normalizes a vector to a unit vector.
|
|
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 275 of file vector4.h. Referenced by csVector4T< float >::Unit(). |
Friends And Related Function Documentation
|
Multiply a vector and a scalar int.
|
|
Multiply a vector and a scalar int.
|
|
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.
|
|
Subtract two vectors.
|
|
Divide a vector by a scalar int.
|
|
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.
|
Member Data Documentation
|
All components.
Definition at line 60 of file vector4.h. Referenced by csVector4T< float >::operator[](). |
|
|
|
|
The documentation for this class was generated from the following file:
- csgeom/vector4.h
Generated for Crystal Space by doxygen 1.4.6