ClanLib
2.3.7
|
4D vector More...
#include <size.h>
Public Types | |
typedef Type | datatype |
Public Member Functions | |
CL_Vec4 () | |
CL_Vec4 (const CL_Vec1< Type > ©) | |
CL_Vec4 (const CL_Vec2< Type > ©) | |
CL_Vec4 (const CL_Vec3< Type > ©) | |
CL_Vec4 (const Type &p1, const Type &p2=0, const Type &p3=0, const Type &p4=0) | |
CL_Vec4 (const Type *array_xyzw) | |
Attributes | |
*Type | length3 () const |
Returns the length (magnitude) of this vector (not taking into account the w ordinate). More... | |
*Type | length4 () const |
Returns the length (magnitude) of this vector (taking into account the w ordinate). More... | |
CL_Vec4< Type > & | normalize3 () |
Normalizes this vector (not taking into account the w ordinate) More... | |
CL_Vec4< Type > & | normalize4 () |
Normalizes this vector (taking into account the w ordinate) More... | |
Type | dot3 (const CL_Vec4< Type > &vector) const |
Dot products this vector with an other vector (not taking into account the w ordinate). More... | |
Type | dot4 (const CL_Vec4< Type > &vector) const |
Dot products this vector with an other vector (taking into account the w ordinate). More... | |
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). More... | |
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). More... | |
Type | distance4 (const CL_Vec4< Type > &vector) const |
Calculate the distance between this vector and an other vector (taking into account the w ordinate). More... | |
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). More... | |
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);. More... | |
CL_Vec4< Type > & | round () |
Rounds all components on this vector. More... | |
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. More... | |
void | operator+= (Type value) |
+= operator. More... | |
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. More... | |
void | operator-= (Type value) |
-= operator. More... | |
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. More... | |
void | operator*= (Type value) |
*= operator. More... | |
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. More... | |
void | operator/= (Type value) |
/= operator. More... | |
CL_Vec4< Type > | operator/ (const CL_Vec4< Type > &vector) const |
/ operator. More... | |
CL_Vec4< Type > | operator/ (Type value) const |
/ operator. More... | |
CL_Vec4< Type > & | operator= (const CL_Vec4< Type > &vector) |
= operator. More... | |
bool | operator== (const CL_Vec4< Type > &vector) const |
== operator. More... | |
bool | operator!= (const CL_Vec4< Type > &vector) const |
!= operator. More... | |
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). More... | |
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). More... | |
static Type | dot4 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2) |
Dot products between two vectors (taking into account the w ordinate). More... | |
static CL_Vec4< Type > | normalize3 (const CL_Vec4< Type > &vector) |
Normalizes a vector (not taking into account the w ordinate) More... | |
static CL_Vec4< Type > | normalize4 (const CL_Vec4< Type > &vector) |
Normalizes a vector (taking into account the w ordinate) More... | |
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);. More... | |
static CL_Vec4< Type > | round (const CL_Vec4< Type > &vector) |
Rounds all components on a vector. More... | |
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.
|
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. |
|
static |
Calculate the cross product between two vectors (not taking into account the w ordinate).
= The first vector = The second vector
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. |
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. |
|
inlinestatic |
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.
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.
|
inlinestatic |
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.
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
|
static |
Normalizes a vector (not taking into account the w ordinate)
Operates in the native datatype
vector | = The vector to use |
Normalizes this vector (not taking into account the w ordinate)
Operates in the native datatype
|
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
|
inline |
|
inline |
|
inline |
!= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
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.
*= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
*= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
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.
+= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
+= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
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.
-= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
-= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
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.
/= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
/= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
= operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
== operator.
References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.
|
inline |
|
inline |
|
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. |
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 |
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 { ... } |
Type CL_Vec4< Type >::a |
Type CL_Vec4< Type >::b |
Type CL_Vec4< Type >::g |
Type CL_Vec4< Type >::r |
Type CL_Vec4< Type >::s |
Type CL_Vec4< Type >::t |
Type CL_Vec4< Type >::u |
Type CL_Vec4< Type >::v |
Type CL_Vec4< Type >::w |
Referenced by CL_Vec4< Type >::CL_Vec4(), CL_Vec4< Type >::dot4(), CL_Vec4< Type >::operator!=(), 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_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
Type CL_Vec4< Type >::x |
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!=(), 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_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
Type CL_Vec4< Type >::y |
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!=(), 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_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().
Type CL_Vec4< Type >::z |
Referenced by CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec4< Type >::dot3(), CL_Vec4< Type >::dot4(), CL_Vec4< Type >::operator!=(), 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_ProgramObject::set_uniform4b(), CL_ProgramObject::set_uniform4f(), CL_ProgramObject::set_uniform4i(), and CL_ProgramObject::set_uniform4s().