3D vector More...
#include <vec3.h>
Public Types | |
typedef Type | datatype |
Public Member Functions | |
CL_Vec3 () | |
template<> | |
CL_Vec3 (const CL_Vec3< int > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< double > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< float > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< int > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< double > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< float > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< int > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< double > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< float > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< int > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< double > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< float > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< int > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< double > ©) | |
template<> | |
CL_Vec3 (const CL_Vec3< float > ©) | |
CL_Vec3 (const Type *array_xyz) | |
CL_Vec3 (const Type &p1, const Type &p2=0, const Type &p3=0) | |
CL_Vec3 (const CL_Vec3< int > ©) | |
CL_Vec3 (const CL_Vec3< float > ©) | |
CL_Vec3 (const CL_Vec3< double > ©) | |
CL_Vec3 (const CL_Vec4< Type > ©) | |
CL_Vec3 (const CL_Vec1< Type > ©) | |
CL_Vec3 (const CL_Vec2< Type > ©) | |
Attributes | |
Type | length () const |
Returns the length (magnitude) of this vector. | |
CL_Vec3< Type > & | normalize () |
Normalizes this vector. | |
Type | dot (const CL_Vec3< Type > &vector) const |
Dot products this vector with an other vector. | |
CL_Angle | angle (const CL_Vec3< Type > &vector) const |
Calculate the angle between this vector and an other vector. | |
Type | distance (const CL_Vec3< Type > &vector) const |
Calculate the distance between this vector and an other vector. | |
CL_Vec3< Type > & | cross (const CL_Vec3< Type > &vector) |
Calculate the cross product between this vector and an other vector. | |
CL_Vec3< Type > & | rotate (const CL_Angle &angle, const CL_Vec3< Type > &axis) |
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. | |
CL_Vec3< 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_Vec3< Type > &vector) |
+= operator. | |
void | operator+= (Type value) |
+= operator. | |
CL_Vec3< Type > | operator+ (const CL_Vec3< Type > &vector) const |
+ operator. | |
CL_Vec3< Type > | operator+ (Type value) const |
+ operator. | |
void | operator-= (const CL_Vec3< Type > &vector) |
-= operator. | |
void | operator-= (Type value) |
-= operator. | |
CL_Vec3< Type > | operator- (const CL_Vec3< Type > &vector) const |
| |
CL_Vec3< Type > | operator- (Type value) const |
| |
void | operator*= (const CL_Vec3< Type > &vector) |
*= operator. | |
void | operator*= (Type value) |
*= operator. | |
CL_Vec3< Type > | operator* (const CL_Vec3< Type > &vector) const |
* operator. | |
CL_Vec3< Type > | operator* (Type value) const |
* operator. | |
void | operator/= (const CL_Vec3< Type > &vector) |
/= operator. | |
void | operator/= (Type value) |
/= operator. | |
CL_Vec3< Type > | operator/ (const CL_Vec3< Type > &vector) const |
/ operator. | |
CL_Vec3< Type > | operator/ (Type value) const |
/ operator. | |
CL_Vec3< Type > & | operator= (const CL_Vec3< Type > &vector) |
= operator. | |
bool | operator== (const CL_Vec3< Type > &vector) const |
== operator. | |
bool | operator!= (const CL_Vec3< Type > &vector) const |
!= operator. | |
Static Public Member Functions | |
static CL_Vec3< Type > | cross (const CL_Vec3< Type > &vector1, const CL_Vec3< Type > &vector2) |
Calculate the cross product between two vectors. | |
static Type | dot (const CL_Vec3< Type > &vector1, const CL_Vec3< Type > &vector2) |
Dot products between two vectors. | |
static CL_Vec3< Type > | normalize (const CL_Vec3< Type > &vector) |
Normalizes a vector. | |
static CL_Vec3< Type > | rotate (const CL_Vec3< Type > &vector, const CL_Angle &angle, const CL_Vec3< Type > &axis) |
Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. | |
static CL_Vec3< Type > | round (const CL_Vec3< 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 | |
}; |
3D vector
These vector templates are defined for:
char (CL_Vec3c), unsigned char (CL_Vec3uc), short (CL_Vec3s),
unsigned short (CL_Vec3us), int (CL_Vec3i), unsigned int (CL_Vec3ui), float (CL_Vecdf), double (CL_Vec3d)
CL_Vec3< Type >::CL_Vec3 | ( | const Type & | p1, | |
const Type & | p2 = 0 , |
|||
const Type & | p3 = 0 | |||
) | [inline] |
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
References CL_Vec3< Type >::x, CL_Vec3< Type >::y, and CL_Vec3< Type >::z.
Calculate the angle between this vector and an other vector.
vector | Second vector used to calculate angle. |
static CL_Vec3<Type> CL_Vec3< Type >::cross | ( | const CL_Vec3< Type > & | vector1, | |
const CL_Vec3< Type > & | vector2 | |||
) | [static] |
Calculate the cross product between two vectors.
vector1 | = The first vector | |
vector2 | = The second vector |
Calculate the cross product between this vector and an other vector.
Operates in the native datatype
vector | = Second vector used to perform the calculation. |
Calculate the distance between this vector and an other vector.
vector | = Second vector used to calculate distance. |
Dot products this vector with an other vector.
Operates in the native datatype
vector | Second vector used for the dot product. |
static Type CL_Vec3< Type >::dot | ( | const CL_Vec3< Type > & | vector1, | |
const CL_Vec3< Type > & | vector2 | |||
) | [inline, static] |
Dot products between two vectors.
Type CL_Vec3< Type >::length | ( | ) | const |
Returns the length (magnitude) of this vector.
Operates in the native datatype
static CL_Vec3<Type> CL_Vec3< Type >::normalize | ( | const CL_Vec3< Type > & | vector | ) | [static] |
Normalizes a vector.
vector | = Vector to use |
Operates in the native datatype
Normalizes this vector.
Operates in the native datatype
CL_Vec3< Type >::operator Type * | ( | ) | [inline] |
CL_Vec3< Type >::operator Type *const | ( | ) | const [inline] |
bool CL_Vec3< Type >::operator!= | ( | const CL_Vec3< Type > & | vector | ) | const [inline] |
!= operator.
CL_Vec3<Type> CL_Vec3< Type >::operator* | ( | const CL_Vec3< Type > & | vector | ) | const [inline] |
* operator.
* operator.
void CL_Vec3< Type >::operator*= | ( | const CL_Vec3< Type > & | vector | ) | [inline] |
*= operator.
void CL_Vec3< Type >::operator*= | ( | Type | value | ) | [inline] |
*= operator.
CL_Vec3<Type> CL_Vec3< Type >::operator+ | ( | const CL_Vec3< Type > & | vector | ) | const [inline] |
+ operator.
+ operator.
void CL_Vec3< Type >::operator+= | ( | Type | value | ) | [inline] |
+= operator.
void CL_Vec3< Type >::operator+= | ( | const CL_Vec3< Type > & | vector | ) | [inline] |
+= operator.
CL_Vec3<Type> CL_Vec3< Type >::operator- | ( | const CL_Vec3< Type > & | vector | ) | const [inline] |
void CL_Vec3< Type >::operator-= | ( | const CL_Vec3< Type > & | vector | ) | [inline] |
-= operator.
void CL_Vec3< Type >::operator-= | ( | Type | value | ) | [inline] |
-= operator.
CL_Vec3<Type> CL_Vec3< Type >::operator/ | ( | const CL_Vec3< Type > & | vector | ) | const [inline] |
/ operator.
/ operator.
void CL_Vec3< Type >::operator/= | ( | const CL_Vec3< Type > & | vector | ) | [inline] |
/= operator.
void CL_Vec3< Type >::operator/= | ( | Type | value | ) | [inline] |
/= operator.
CL_Vec3<Type>& CL_Vec3< Type >::operator= | ( | const CL_Vec3< Type > & | vector | ) | [inline] |
= operator.
bool CL_Vec3< Type >::operator== | ( | const CL_Vec3< Type > & | vector | ) | const [inline] |
== operator.
Type& CL_Vec3< Type >::operator[] | ( | unsigned int | i | ) | [inline] |
const Type& CL_Vec3< Type >::operator[] | ( | unsigned int | i | ) | const [inline] |
CL_Vec3<Type>& CL_Vec3< Type >::rotate | ( | const CL_Angle & | angle, | |
const CL_Vec3< Type > & | axis | |||
) |
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);.
angle | Angle to rotate. | |
axis | Rotation axis. |
static CL_Vec3<Type> CL_Vec3< Type >::rotate | ( | const CL_Vec3< Type > & | vector, | |
const CL_Angle & | angle, | |||
const CL_Vec3< Type > & | axis | |||
) | [static] |
Rotate a vector around an axis. Same as glRotate[f|d](angle, a);.
vector | = Vector to use | |
angle | = Angle to rotate. | |
axis | = Rotation axis. |
static CL_Vec3<Type> CL_Vec3< Type >::round | ( | const CL_Vec3< Type > & | vector | ) | [static] |
Rounds all components on a vector.
Uses Asymmetric Arithmetic Rounding
vector | = Vector to use |
Rounds all components on this vector.
Uses Asymmetric Arithmetic Rounding
union { ... } |
union { ... } |
union { ... } |
Referenced by CL_Vec1< Type >::CL_Vec1(), CL_Vec2< int >::CL_Vec2(), CL_Vec3< double >::CL_Vec3(), CL_Vec3< float >::CL_Vec3(), CL_Vec3< Type >::CL_Vec3(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec3< int >::dot(), CL_Vec3< int >::operator!=(), operator*(), CL_Vec3< int >::operator*(), CL_Vec3< int >::operator*=(), CL_Vec3< int >::operator+(), CL_Vec3< int >::operator+=(), CL_Vec3< int >::operator-(), CL_Vec3< int >::operator-=(), CL_Vec3< int >::operator/(), CL_Vec3< int >::operator/=(), CL_Vec3< int >::operator=(), CL_Vec3< int >::operator==(), CL_ProgramObject::set_uniform3b(), CL_ProgramObject::set_uniform3f(), CL_ProgramObject::set_uniform3i(), and CL_ProgramObject::set_uniform3s().
Referenced by CL_Vec2< int >::CL_Vec2(), CL_Vec3< double >::CL_Vec3(), CL_Vec3< float >::CL_Vec3(), CL_Vec3< Type >::CL_Vec3(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec3< int >::dot(), CL_Vec3< int >::operator!=(), operator*(), CL_Vec3< int >::operator*(), CL_Vec3< int >::operator*=(), CL_Vec3< int >::operator+(), CL_Vec3< int >::operator+=(), CL_Vec3< int >::operator-(), CL_Vec3< int >::operator-=(), CL_Vec3< int >::operator/(), CL_Vec3< int >::operator/=(), CL_Vec3< int >::operator=(), CL_Vec3< int >::operator==(), CL_ProgramObject::set_uniform3b(), CL_ProgramObject::set_uniform3f(), CL_ProgramObject::set_uniform3i(), and CL_ProgramObject::set_uniform3s().
Referenced by CL_Vec3< double >::CL_Vec3(), CL_Vec3< float >::CL_Vec3(), CL_Vec3< Type >::CL_Vec3(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_Vec3< int >::dot(), CL_Vec3< int >::operator!=(), operator*(), CL_Vec3< int >::operator*(), CL_Vec3< int >::operator*=(), CL_Vec3< int >::operator+(), CL_Vec3< int >::operator+=(), CL_Vec3< int >::operator-(), CL_Vec3< int >::operator-=(), CL_Vec3< int >::operator/(), CL_Vec3< int >::operator/=(), CL_Vec3< int >::operator=(), CL_Vec3< int >::operator==(), CL_ProgramObject::set_uniform3b(), CL_ProgramObject::set_uniform3f(), CL_ProgramObject::set_uniform3i(), and CL_ProgramObject::set_uniform3s().