|
| Vector3 () |
| Creates an uninitialized vector. More...
|
|
| Vector3 (T x, T y, T z) |
| Creates a vector with the specified values. More...
|
|
template<class T2 , class M2 > |
| Vector3 (const Vector3< T2, M2 > &x) |
| Copies the specified vector. More...
|
|
| Vector3 (const float *va) |
| Copies a float array vector. More...
|
|
| Vector3 (int i) |
| Creates a vector initialized to zero. More...
|
|
template<class T2 , class M2 > |
| Vector3 (const Vector4< T2, M2 > &x) |
| Cast from homogenious coordinates. More...
|
|
Vector3< T, M > & | operator= (const Vector3< T, M > &o) |
| Copy operator. More...
|
|
template<class T2 , class M2 > |
Vector3< T, M > & | operator= (const Vector3< T2, M2 > &o) |
| Copy operator. More...
|
|
Vector3< T, M > & | operator= (const float *va) |
| Copies a float array vector. More...
|
|
Vector3< T, M > | operator- () const |
| Negates the vector. More...
|
|
Vector3< T, M > | normalized () const |
| Returns a normalized version of this vector. More...
|
|
Vector3< T, M > | hsv2rgb () const |
| This function treats this vector as a HSV space color vector and returns it transformed to RGB color space. More...
|
|
Vector3< T, M > | rgb2hsv () const |
| This function treats this vector as a RGB space color vector and returns it transformed to HSV color space. More...
|
|
T | length () const |
| Returns the length of this vector. More...
|
|
T | length2 () const |
| Returns the square length of this vector. More...
|
|
| operator const T * () const |
| Casts this vector to an array representation. More...
|
|
| operator T * () |
| Casts this vector to an array representation. More...
|
|
const T & | operator() (int i) const |
| Index operator. More...
|
|
const T & | operator[] (int i) const |
| Index operator. More...
|
|
T & | operator() (int i) |
| Index operator. More...
|
|
T & | operator[] (int i) |
| Index operator. More...
|
|
template<class S > |
bool | fromScreenPosition (S sx, S sy, a3d::Vector3< T, M > &x, a3d::Vector3< T, M > &v) |
|
template<class T, class M = Math<T>>
struct a3d::Vector3< T, M >
A vector of three values for 3d calculations.
template<class T, class M = Math<T>>
template<class S >
If this is called in an OpenGL context it will find the 3D equivalent of the specified screen position and the vector that points straight in at that position.
Two values are given representing the 2D screen coordinate and two vectors in which the result will be inserted. The function will return true on success.
- Parameters
-
sx | screen x coordinate in the range zero to screen width minus one |
sy | screen y coordinate in the range zero to screen height minus one. |
This coordinate is usually defined upside down compared to the 3D system, but if it is not just negate the parameter and this function treats it as not upside down.
- Parameters
-
x | the specified screen coordinate in 3D space |
v | a unit vector pointing from eye to x position |
- Returns
- true on successful estimation
template<class T, class M = Math<T>>
Casts this vector to an array representation.
This makes it possible to provide for example a float vector as an array argument in for example OpenGL.
Use like this:
Vector3f c = Vector3f::hsv2rgb( 0.5, 0.5, 0.5 );
glColor3fv( (float*)c );
References a3d::Vector3< T, M >::v.
template<class T, class M = Math<T>>
Casts this vector to an array representation.
This makes it possible to provide for example a float vector as an array argument in for example OpenGL. Anything written in the returned array will end up in the vector.
Use like this:
Vector3f c = Vector3f::hsv2rgb( 0.5, 0.5, 0.5 );
glColor3fv( (float*)c );
References a3d::Vector3< T, M >::v.