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[] (size_t n) |
Returns n-th component of the vector. | |
float | operator[] (size_t 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
csVector4T< T >::csVector4T | ( | ) | [inline] |
csVector4T< T >::csVector4T | ( | const T & | m | ) | [inline] |
csVector4T< T >::csVector4T | ( | const T & | ix, | |
const T & | iy, | |||
const T & | iz = T(0) , |
|||
const T & | iw = T(1) | |||
) | [inline] |
csVector4T< T >::csVector4T | ( | const csVector4T< T > & | v | ) | [inline] |
csVector4T< T >::csVector4T | ( | const csVector3 & | v | ) | [inline] |
Member Function Documentation
void csVector4T< T >::Cross | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [inline] |
csString csVector4T< T >::Description | ( | ) | const [inline] |
void csVector4T< T >::Get | ( | T * | v | ) | [inline] |
bool csVector4T< T >::IsZero | ( | T | precision = SMALL_EPSILON |
) | const [inline] |
static T csVector4T< T >::Norm | ( | const csVector4T< T > & | v | ) | [inline, static] |
T csVector4T< T >::Norm | ( | ) | const [inline] |
Returns the norm of this vector.
Definition at line 265 of file vector4.h.
Referenced by csVector4T< float >::Norm(), and csVector4T< float >::Unit().
void csVector4T< T >::Normalize | ( | ) | [inline] |
csVector4T& csVector4T< T >::operator *= | ( | T | f | ) | [inline] |
csVector4T csVector4T< T >::operator+ | ( | ) | const [inline] |
csVector4T& csVector4T< T >::operator+= | ( | const csVector4T< T > & | v | ) | [inline] |
csVector4T csVector4T< T >::operator- | ( | ) | const [inline] |
csVector4T& csVector4T< T >::operator-= | ( | const csVector4T< T > & | v | ) | [inline] |
csVector4T& csVector4T< T >::operator/= | ( | T | f | ) | [inline] |
csVector4T& csVector4T< T >::operator= | ( | const csVector4T< T2 > & | other | ) | [inline] |
float& csVector4T< T >::operator[] | ( | size_t | n | ) | [inline] |
float csVector4T< T >::operator[] | ( | size_t | n | ) | const [inline] |
void csVector4T< T >::Set | ( | T | v | ) | [inline] |
void csVector4T< T >::Set | ( | T const * | v | ) | [inline] |
void csVector4T< T >::Set | ( | csVector4T< T > const & | v | ) | [inline] |
void csVector4T< T >::Set | ( | T | sx, | |
T | sy, | |||
T | sz, | |||
T | sw | |||
) | [inline] |
T csVector4T< T >::SquaredNorm | ( | ) | const [inline] |
static csVector4T csVector4T< T >::Unit | ( | const csVector4T< T > & | v | ) | [inline, static] |
csVector4T csVector4T< T >::Unit | ( | ) | const [inline] |
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 276 of file vector4.h.
Referenced by csVector4T< float >::Unit().
Friends And Related Function Documentation
csVector4T operator * | ( | int | f, | |
const csVector4T< T > & | v | |||
) | [friend] |
csVector4T operator * | ( | const csVector4T< T > & | v, | |
int | f | |||
) | [friend] |
csVector4T operator * | ( | float | f, | |
const csVector4T< T > & | v | |||
) | [friend] |
csVector4T operator * | ( | const csVector4T< T > & | v, | |
T | f | |||
) | [friend] |
float operator * | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
bool operator!= | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
csVector4T operator% | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
csVector4T operator+ | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
csVector4T operator- | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
csVector4T operator/ | ( | const csVector4T< T > & | v, | |
int | f | |||
) | [friend] |
csVector4T operator/ | ( | const csVector4T< T > & | v, | |
T | f | |||
) | [friend] |
bool operator< | ( | const csVector4T< T > & | v, | |
float | f | |||
) | [friend] |
csVector4T operator<< | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
bool operator== | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
bool operator> | ( | float | f, | |
const csVector4T< T > & | v | |||
) | [friend] |
csVector4T operator>> | ( | const csVector4T< T > & | v1, | |
const csVector4T< T > & | v2 | |||
) | [friend] |
Member Data Documentation
T csVector4T< T >::m[4] |
All components.
Definition at line 60 of file vector4.h.
Referenced by csVector4T< float >::operator[]().
T csVector4T< T >::w |
The W component of the vector.
Definition at line 56 of file vector4.h.
Referenced by csVector4T< float >::Cross(), csVector4T< float >::Description(), csVector4T< float >::Get(), csVector4T< float >::IsZero(), csVector4T< float >::Norm(), csVector4T< float >::Normalize(), csVector4T< float >::operator *=(), csVector4T< float >::operator+=(), csVector4T< float >::operator-(), csVector4T< float >::operator-=(), csVector4T< float >::operator/=(), csVector4::operator=(), csVector4T< float >::operator=(), csVector4T< float >::Set(), csShaderVariable::SetValue(), and csVector4T< float >::SquaredNorm().
T csVector4T< T >::x |
The X component of the vector.
Definition at line 50 of file vector4.h.
Referenced by csVector4T< float >::Cross(), csVector4T< float >::Description(), csVector4T< float >::Get(), csVector4T< float >::IsZero(), csVector4T< float >::Norm(), csVector4T< float >::Normalize(), csVector4T< float >::operator *=(), csVector4T< float >::operator+=(), csVector4T< float >::operator-(), csVector4T< float >::operator-=(), csVector4T< float >::operator/=(), csVector4::operator=(), csVector4T< float >::operator=(), csVector4T< float >::Set(), csShaderVariable::SetValue(), and csVector4T< float >::SquaredNorm().
T csVector4T< T >::y |
The Y component of the vector.
Definition at line 52 of file vector4.h.
Referenced by csVector4T< float >::Cross(), csVector4T< float >::Description(), csVector4T< float >::Get(), csVector4T< float >::IsZero(), csVector4T< float >::Norm(), csVector4T< float >::Normalize(), csVector4T< float >::operator *=(), csVector4T< float >::operator+=(), csVector4T< float >::operator-(), csVector4T< float >::operator-=(), csVector4T< float >::operator/=(), csVector4::operator=(), csVector4T< float >::operator=(), csVector4T< float >::Set(), csShaderVariable::SetValue(), and csVector4T< float >::SquaredNorm().
T csVector4T< T >::z |
The Z component of the vector.
Definition at line 54 of file vector4.h.
Referenced by csVector4T< float >::Cross(), csVector4T< float >::Description(), csVector4T< float >::Get(), csVector4T< float >::IsZero(), csVector4T< float >::Norm(), csVector4T< float >::Normalize(), csVector4T< float >::operator *=(), csVector4T< float >::operator+=(), csVector4T< float >::operator-(), csVector4T< float >::operator-=(), csVector4T< float >::operator/=(), csVector4::operator=(), csVector4T< float >::operator=(), csVector4T< float >::Set(), csShaderVariable::SetValue(), and csVector4T< float >::SquaredNorm().
The documentation for this class was generated from the following file:
- csgeom/vector4.h
Generated for Crystal Space by doxygen 1.4.7