4D vector More...
#include <vec4.h>
Public Types | |
| typedef Type | datatype |
Public Member Functions | |
| CL_Vec4 () | |
| CL_Vec4 (const Type *array_xyzw) | |
| CL_Vec4 (const Type &p1, const Type &p2=0, const Type &p3=0, const Type &p4=0) | |
| CL_Vec4 (const CL_Vec3< Type > ©) | |
| CL_Vec4 (const CL_Vec2< Type > ©) | |
| CL_Vec4 (const CL_Vec1< Type > ©) | |
Attributes | |
| *Type | length3 () const |
| Returns the length (magnitude) of this vector (not taking into account the w ordinate). | |
| *Type | length4 () const |
| Returns the length (magnitude) of this vector (taking into account the w ordinate). | |
| CL_Vec4< Type > & | normalize3 () |
| Normalizes this vector (not taking into account the w ordinate). | |
| CL_Vec4< Type > & | normalize4 () |
| Normalizes this vector (taking into account the w ordinate). | |
| Type | dot3 (const CL_Vec4< Type > &vector) const |
| Dot products this vector with an other vector (not taking into account the w ordinate). | |
| Type | dot4 (const CL_Vec4< Type > &vector) const |
| Dot products this vector with an other vector (taking into account the w ordinate). | |
| CL_Angle | angle3 (const CL_Vec4< Type > &vector) const |
| Calculate the angle between this vector and an other vector (not taking into account the w ordinate). | |
| Type | distance3 (const CL_Vec4< Type > &vector) const |
| Calculate the distance between this vector and an other vector (not taking into account the w ordinate). | |
| Type | distance4 (const CL_Vec4< Type > &vector) const |
| Calculate the distance between this vector and an other vector (taking into account the w ordinate). | |
| CL_Vec4< Type > & | cross3 (const CL_Vec4< Type > &vector) |
| Calculate the cross product between this vector and an other vector (not taking into account the w ordinate). | |
| CL_Vec4< Type > & | rotate3 (const CL_Angle &angle, const CL_Vec4< Type > &axis) |
| Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. | |
| CL_Vec4< Type > & | round () |
| Rounds all components on this vector. | |
Operators | |
| const Type & | operator[] (unsigned int i) const |
| Type & | operator[] (unsigned int i) |
| operator Type * () | |
| operator Type *const () const | |
| void | operator+= (const CL_Vec4< Type > &vector) |
| += operator. | |
| void | operator+= (Type value) |
| += operator. | |
| CL_Vec4< Type > | operator+ (const CL_Vec4< Type > &vector) const |
| + operator. | |
| CL_Vec4< Type > | operator+ (Type value) const |
| + operator. | |
| void | operator-= (const CL_Vec4< Type > &vector) |
| -= operator. | |
| void | operator-= (Type value) |
| -= operator. | |
| CL_Vec4< Type > | operator- (const CL_Vec4< Type > &vector) const |
| |
| CL_Vec4< Type > | operator- (Type value) const |
| |
| void | operator*= (const CL_Vec4< Type > &vector) |
| *= operator. | |
| void | operator*= (Type value) |
| *= operator. | |
| CL_Vec4< Type > | operator* (const CL_Vec4< Type > &vector) const |
| * operator. | |
| CL_Vec4< Type > | operator* (Type value) const |
| * operator. | |
| void | operator/= (const CL_Vec4< Type > &vector) |
| /= operator. | |
| void | operator/= (Type value) |
| /= operator. | |
| CL_Vec4< Type > | operator/ (const CL_Vec4< Type > &vector) const |
| / operator. | |
| CL_Vec4< Type > | operator/ (Type value) const |
| / operator. | |
| CL_Vec4< Type > & | operator= (const CL_Vec4< Type > &vector) |
| = operator. | |
| bool | operator== (const CL_Vec4< Type > &vector) const |
| == operator. | |
| bool | operator!= (const CL_Vec4< Type > &vector) const |
| != operator. | |
Static Public Member Functions | |
| static CL_Vec4< Type > | cross3 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2) |
| Calculate the cross product between two vectors (not taking into account the w ordinate). | |
| static Type | dot3 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2) |
| Dot products between two vectors (not taking into account the w ordinate). | |
| static Type | dot4 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2) |
| Dot products between two vectors (taking into account the w ordinate). | |
| static CL_Vec4< Type > | normalize3 (const CL_Vec4< Type > &vector) |
| Normalizes a vector (not taking into account the w ordinate). | |
| static CL_Vec4< Type > | normalize4 (const CL_Vec4< Type > &vector) |
| Normalizes a vector (taking into account the w ordinate). | |
| static CL_Vec4< Type > | rotate3 (const CL_Vec4< Type > &vector, const CL_Angle &angle, const CL_Vec4< Type > &axis) |
| Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. | |
| static CL_Vec4< Type > | round (const CL_Vec4< Type > &vector) |
| Rounds all components on a vector. | |
Public Attributes | |
| union { | |
| Type r | |
| Type s | |
| Type x | |
| }; | |
| union { | |
| Type g | |
| Type t | |
| Type y | |
| }; | |
| union { | |
| Type b | |
| Type u | |
| Type z | |
| }; | |
| union { | |
| Type a | |
| Type v | |
| Type w | |
| }; | |
4D vector
These vector templates are defined for:
char (CL_Vec4c), unsigned char (CL_Vec4uc), short (CL_Vec4s),
unsigned short (CL_Vec4us), int (CL_Vec4i), unsigned int (CL_Vec4ui), float (CL_Vec4f), double (CL_Vec4d)
References CL_Vec4< Type >::w, CL_Vec1< Type >::x, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| CL_Vec4< Type >::CL_Vec4 | ( | const Type & | p1, | |
| const Type & | p2 = 0, |
|||
| const Type & | p3 = 0, |
|||
| const Type & | p4 = 0 | |||
| ) | [inline] |
Calculate the angle between this vector and an other vector (not taking into account the w ordinate).
| vector | = Second vector used to calculate angle. |
Calculate the cross product between this vector and an other vector (not taking into account the w ordinate).
Operates in the native datatype
| vector | Second vector used to perform the calculation. |
| static CL_Vec4<Type> CL_Vec4< Type >::cross3 | ( | const CL_Vec4< Type > & | vector1, | |
| const CL_Vec4< Type > & | vector2 | |||
| ) | [static] |
Calculate the cross product between two vectors (not taking into account the w ordinate).
= The first vector = The second vector
Calculate the distance between this vector and an other vector (not taking into account the w ordinate).
| vector | = Second vector used to calculate distance. |
Calculate the distance between this vector and an other vector (taking into account the w ordinate).
| vector | = Second vector used to calculate distance. |
| static Type CL_Vec4< Type >::dot3 | ( | const CL_Vec4< Type > & | vector1, | |
| const CL_Vec4< Type > & | vector2 | |||
| ) | [inline, static] |
Dot products between two vectors (not taking into account the w ordinate).
Operates in the native datatype
| vector1 | First vector used for the dot product. | |
| vector2 | Second vector used for the dot product. |
References CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| Type CL_Vec4< Type >::dot3 | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
Dot products this vector with an other vector (not taking into account the w ordinate).
Operates in the native datatype
| vector | Second vector used for the dot product. |
References CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| static Type CL_Vec4< Type >::dot4 | ( | const CL_Vec4< Type > & | vector1, | |
| const CL_Vec4< Type > & | vector2 | |||
| ) | [inline, static] |
Dot products between two vectors (taking into account the w ordinate).
Operates in the native datatype
| vector1 | First vector used for the dot product. | |
| vector2 | Second vector used for the dot product. |
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| Type CL_Vec4< Type >::dot4 | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
Dot products this vector with an other vector (taking into account the w ordinate).
Operates in the native datatype
| vector | Second vector used for the dot product. |
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| * Type CL_Vec4< Type >::length3 | ( | ) | const |
Returns the length (magnitude) of this vector (not taking into account the w ordinate).
Operates in the native datatype
| * Type CL_Vec4< Type >::length4 | ( | ) | const |
Returns the length (magnitude) of this vector (taking into account the w ordinate).
Operates in the native datatype
Normalizes this vector (not taking into account the w ordinate).
Operates in the native datatype
| static CL_Vec4<Type> CL_Vec4< Type >::normalize3 | ( | const CL_Vec4< Type > & | vector | ) | [static] |
Normalizes a vector (not taking into account the w ordinate).
Operates in the native datatype
| vector | = The vector to use |
| static CL_Vec4<Type> CL_Vec4< Type >::normalize4 | ( | const CL_Vec4< Type > & | vector | ) | [static] |
Normalizes a vector (taking into account the w ordinate).
Operates in the native datatype
| vector | = The vector to use |
Normalizes this vector (taking into account the w ordinate).
Operates in the native datatype
| CL_Vec4< Type >::operator Type * | ( | ) | [inline] |
| CL_Vec4< Type >::operator Type *const | ( | ) | const [inline] |
| bool CL_Vec4< Type >::operator!= | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
!= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| CL_Vec4<Type> CL_Vec4< Type >::operator* | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
* operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
* operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator*= | ( | const CL_Vec4< Type > & | vector | ) | [inline] |
*= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator*= | ( | Type | value | ) | [inline] |
*= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| CL_Vec4<Type> CL_Vec4< Type >::operator+ | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
+ operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
+ operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator+= | ( | Type | value | ) | [inline] |
+= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator+= | ( | const CL_Vec4< Type > & | vector | ) | [inline] |
+= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| CL_Vec4<Type> CL_Vec4< Type >::operator- | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator-= | ( | Type | value | ) | [inline] |
-= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator-= | ( | const CL_Vec4< Type > & | vector | ) | [inline] |
-= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
/ operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| CL_Vec4<Type> CL_Vec4< Type >::operator/ | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
/ operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator/= | ( | Type | value | ) | [inline] |
/= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| void CL_Vec4< Type >::operator/= | ( | const CL_Vec4< Type > & | vector | ) | [inline] |
/= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| CL_Vec4<Type>& CL_Vec4< Type >::operator= | ( | const CL_Vec4< Type > & | vector | ) | [inline] |
= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| bool CL_Vec4< Type >::operator== | ( | const CL_Vec4< Type > & | vector | ) | const [inline] |
== operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
| const Type& CL_Vec4< Type >::operator[] | ( | unsigned int | i | ) | const [inline] |
| Type& CL_Vec4< Type >::operator[] | ( | unsigned int | i | ) | [inline] |
| CL_Vec4<Type>& CL_Vec4< Type >::rotate3 | ( | const CL_Angle & | angle, | |
| const CL_Vec4< Type > & | axis | |||
| ) |
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);.
Not taking into account the w ordinate
The w ordinate is not modified
| angle | Angle to rotate | |
| axis | Rotation axis. |
| static CL_Vec4<Type> CL_Vec4< Type >::rotate3 | ( | const CL_Vec4< Type > & | vector, | |
| const CL_Angle & | angle, | |||
| const CL_Vec4< Type > & | axis | |||
| ) | [static] |
Rotate a vector around an axis. Same as glRotate[f|d](angle, a);.
Not taking into account the w ordinate
The w ordinate is not modified
| vector | = The vector to use | |
| angle | Angle to rotate | |
| axis | Rotation axis. |
| static CL_Vec4<Type> CL_Vec4< Type >::round | ( | const CL_Vec4< Type > & | vector | ) | [static] |
Rounds all components on a vector.
Includes the w ordinate
Uses Asymmetric Arithmetic Rounding
| vector | = The vector to use |
Rounds all components on this vector.
Includes the w ordinate
Uses Asymmetric Arithmetic Rounding
| union { ... } |
| union { ... } |
| union { ... } |
| union { ... } |
Referenced by CL_Vec4< Type >::CL_Vec4(), CL_Vec4< Type >::dot4(), CL_Vec4< Type >::operator!=(), operator*(), CL_Vec4< Type >::operator*(), CL_Vec4< Type >::operator*=(), CL_Vec4< Type >::operator+(), CL_Vec4< Type >::operator+=(), CL_Vec4< Type >::operator-(), CL_Vec4< Type >::operator-=(), CL_Vec4< Type >::operator/(), CL_Vec4< Type >::operator/=(), CL_Vec4< Type >::operator=(), CL_Vec4< Type >::operator==(), CL_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
Referenced by CL_Vec1< Type >::CL_Vec1(), CL_Vec2< int >::CL_Vec2(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec4< Type >::dot3(), CL_Vec4< Type >::dot4(), CL_Vec4< Type >::operator!=(), operator*(), CL_Vec4< Type >::operator*(), CL_Vec4< Type >::operator*=(), CL_Vec4< Type >::operator+(), CL_Vec4< Type >::operator+=(), CL_Vec4< Type >::operator-(), CL_Vec4< Type >::operator-=(), CL_Vec4< Type >::operator/(), CL_Vec4< Type >::operator/=(), CL_Vec4< Type >::operator=(), CL_Vec4< Type >::operator==(), CL_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
Referenced by CL_Vec2< int >::CL_Vec2(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec4< Type >::dot3(), CL_Vec4< Type >::dot4(), CL_Vec4< Type >::operator!=(), operator*(), CL_Vec4< Type >::operator*(), CL_Vec4< Type >::operator*=(), CL_Vec4< Type >::operator+(), CL_Vec4< Type >::operator+=(), CL_Vec4< Type >::operator-(), CL_Vec4< Type >::operator-=(), CL_Vec4< Type >::operator/(), CL_Vec4< Type >::operator/=(), CL_Vec4< Type >::operator=(), CL_Vec4< Type >::operator==(), CL_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
Referenced by CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec4< Type >::dot3(), CL_Vec4< Type >::dot4(), CL_Vec4< Type >::operator!=(), operator*(), CL_Vec4< Type >::operator*(), CL_Vec4< Type >::operator*=(), CL_Vec4< Type >::operator+(), CL_Vec4< Type >::operator+=(), CL_Vec4< Type >::operator-(), CL_Vec4< Type >::operator-=(), CL_Vec4< Type >::operator/(), CL_Vec4< Type >::operator/=(), CL_Vec4< Type >::operator=(), CL_Vec4< Type >::operator==(), CL_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
1.7.1