3D vector More...
#include <vec3.h>
Public Types | |
| typedef Type | datatype |
Public Member Functions | |
| Vec3 () | |
| Vec3 (const Type &p1, const Type &p2, const Type &p3) | |
| Vec3 (const Type &scalar) | |
| Vec3 (const Type *array_xyz) | |
| Vec3 (const Vec2< Type > ©, const Type &p3) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< double > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< float > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec3< int > ©) | |
| Vec3 (const Vec4< Type > ©) | |
| Angle | angle (const Vec3< Type > &vector) const |
| Calculate the angle between this vector and an other vector. | |
| Angle | angle_normed (const Vec3< Type > &vector) const |
| Calculate the angle between this vector and an other vector, where the vectors are unit vectors. | |
| Vec3< Type > & | cross (const Vec3< Type > &vector) |
| Calculate the cross product between this vector and an other vector. | |
| Type | distance (const Vec3< Type > &vector) const |
| Calculate the distance between this vector and an other vector. | |
| Type | dot (const Vec3< Type > &vector) const |
| Dot products this vector with an other vector. | |
| bool | is_equal (const Vec3< Type > &other, Type epsilon) const |
| Returns true if equal within the bounds of an epsilon. | |
| Type | length () const |
| Returns the length (magnitude) of this vector. | |
| double | length () const |
| float | length () const |
| Vec3< Type > & | normalize () |
| Normalizes this vector. | |
| bool | operator!= (const Vec3< Type > &vector) const |
| != operator. | |
| void | operator*= (const Vec3< Type > &vector) |
| *= operator. | |
| void | operator*= (Type value) |
| *= operator. | |
| void | operator+= (const Vec3< Type > &vector) |
| += operator. | |
| void | operator+= (Type value) |
| += operator. | |
| Vec3< Type > | operator- () const |
| |
| void | operator-= (const Vec3< Type > &vector) |
| -= operator. | |
| void | operator-= (Type value) |
| -= operator. | |
| void | operator/= (const Vec3< Type > &vector) |
| /= operator. | |
| void | operator/= (Type value) |
| /= operator. | |
| bool | operator< (const Vec3< Type > &vector) const |
| < operator. | |
| Vec3< Type > & | operator= (const Vec3< Type > &vector) |
| = operator. | |
| bool | operator== (const Vec3< Type > &vector) const |
| == operator. | |
| Vec3< Type > & | rotate (const Angle &angle, const Vec3< Type > &axis) |
| Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. | |
| Vec3< Type > & | round () |
| Rounds all components on this vector. | |
Static Public Member Functions | |
| static Vec3< Type > | cross (const Vec3< Type > &vector1, const Vec3< Type > &vector2) |
| Calculate the cross product between two vectors. | |
| static Type | dot (const Vec3< Type > &vector1, const Vec3< Type > &vector2) |
| Dot products between two vectors. | |
| static bool | is_equal (const Vec3< Type > &first, const Vec3< Type > &second, Type epsilon) |
| Returns true if equal within the bounds of an epsilon. | |
| static Vec3< Type > | normalize (const Vec3< Type > &vector) |
| Normalizes a vector. | |
| static Vec3< Type > | reflect (const Vec3< Type > &incident, const Vec3< Type > &normal) |
| Calculate the reflection direction for an incident vector. | |
| static Vec3< Type > | rotate (const Vec3< Type > &vector, const Angle &angle, const Vec3< Type > &axis) |
| Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. | |
| static Vec3< Type > | round (const 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 (Vec3c), unsigned char (Vec3uc), short (Vec3s),
unsigned short (Vec3us), int (Vec3i), unsigned int (Vec3ui), float (Vecdf), double (Vec3d)
| typedef Type clan::Vec3< Type >::datatype |
|
inline |
Referenced by clan::Vec3< Type >::operator-().
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
| clan::Vec3< Type >::Vec3 | ( | const Vec3< double > & | copy | ) |
| clan::Vec3< Type >::Vec3 | ( | const Vec3< float > & | copy | ) |
| clan::Vec3< Type >::Vec3 | ( | const Vec3< int > & | copy | ) |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| Angle clan::Vec3< Type >::angle | ( | const Vec3< Type > & | vector | ) | const |
Calculate the angle between this vector and an other vector.
| vector | Second vector used to calculate angle. |
| Angle clan::Vec3< Type >::angle_normed | ( | const Vec3< Type > & | vector | ) | const |
Calculate the angle between this vector and an other vector, where the vectors are unit vectors.
| vector | Second vector used to calculate angle. |
| Vec3< Type > & clan::Vec3< Type >::cross | ( | const Vec3< Type > & | 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. |
|
static |
Calculate the cross product between two vectors.
| vector1 | = The first vector |
| vector2 | = The second vector |
| Type clan::Vec3< Type >::distance | ( | const Vec3< Type > & | vector | ) | const |
Calculate the distance between this vector and an other vector.
| vector | = Second vector used to calculate distance. |
|
inline |
Dot products this vector with an other vector.
Operates in the native datatype
| vector | Second vector used for the dot product. |
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inlinestatic |
Dot products between two vectors.
|
inlinestatic |
Returns true if equal within the bounds of an epsilon.
| first | = Value A |
| second | = Value B |
| epsilon | = The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2) |
Referenced by clan::Vec3< Type >::is_equal().
|
inline |
Returns true if equal within the bounds of an epsilon.
| other | = Other value |
| epsilon | = The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2) |
References clan::Vec3< Type >::is_equal().
|
inline |
|
inline |
|
inline |
!= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
*= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
*= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
+= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
+= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
References clan::Vec3< Type >::Vec3(), clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
-= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
-= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
/= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
/= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
< operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
= operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
inline |
== operator.
References clan::Vec3< Type >::x, clan::Vec3< Type >::y, and clan::Vec3< Type >::z.
|
static |
Calculate the reflection direction for an incident vector.
Normal vector should be normalized
| Vec3< Type > & clan::Vec3< Type >::rotate | ( | const Angle & | angle, |
| const Vec3< Type > & | axis ) |
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);.
| angle | Angle to rotate. |
| axis | Rotation 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. |
| Vec3< Type > & clan::Vec3< Type >::round | ( | ) |
Rounds all components on this vector.
Uses Asymmetric Arithmetic Rounding
|
static |
Rounds all components on a vector.
Uses Asymmetric Arithmetic Rounding
| vector | = Vector to use |
| union { ... } clan::Vec3< Type > |
| union { ... } clan::Vec3< Type > |
| union { ... } clan::Vec3< Type > |
| Type clan::Vec3< Type >::b |
| Type clan::Vec3< Type >::g |
| Type clan::Vec3< Type >::r |
| Type clan::Vec3< Type >::s |
| Type clan::Vec3< Type >::t |
| Type clan::Vec3< Type >::u |
| Type clan::Vec3< Type >::x |
Referenced by clan::Vec2< Type >::Vec2(), clan::Vec3< Type >::Vec3(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec3< Type >::dot(), clan::Mat4< Type >::look_at(), clan::Vec3< Type >::operator!=(), clan::Vec3< Type >::operator*=(), clan::Vec3< Type >::operator*=(), clan::Vec3< Type >::operator+=(), clan::Vec3< Type >::operator+=(), clan::Vec3< Type >::operator-(), clan::Vec3< Type >::operator-=(), clan::Vec3< Type >::operator-=(), clan::Vec3< Type >::operator/=(), clan::Vec3< Type >::operator/=(), clan::Vec3< Type >::operator<(), clan::operator<<(), clan::Vec3< Type >::operator=(), clan::Vec3< Type >::operator==(), clan::Mat3< Type >::rotate(), clan::Mat4< Type >::rotate(), clan::Mat3< Type >::scale(), clan::Mat4< Type >::scale(), clan::Mat4< Type >::set_translate(), clan::ProgramObject::set_uniform3b(), clan::ProgramObject::set_uniform3f(), clan::ProgramObject::set_uniform3i(), clan::ProgramObject::set_uniform3s(), clan::ProgramObject::set_uniformfv(), clan::ProgramObject::set_uniformiv(), clan::step(), clan::Mat4< Type >::translate(), and clan::Mat4< Type >::translate_self().
| Type clan::Vec3< Type >::y |
Referenced by clan::Vec2< Type >::Vec2(), clan::Vec3< Type >::Vec3(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec3< Type >::dot(), clan::Mat4< Type >::look_at(), clan::Vec3< Type >::operator!=(), clan::Vec3< Type >::operator*=(), clan::Vec3< Type >::operator*=(), clan::Vec3< Type >::operator+=(), clan::Vec3< Type >::operator+=(), clan::Vec3< Type >::operator-(), clan::Vec3< Type >::operator-=(), clan::Vec3< Type >::operator-=(), clan::Vec3< Type >::operator/=(), clan::Vec3< Type >::operator/=(), clan::Vec3< Type >::operator<(), clan::operator<<(), clan::Vec3< Type >::operator=(), clan::Vec3< Type >::operator==(), clan::Mat3< Type >::rotate(), clan::Mat4< Type >::rotate(), clan::Mat3< Type >::scale(), clan::Mat4< Type >::scale(), clan::Mat4< Type >::set_translate(), clan::ProgramObject::set_uniform3b(), clan::ProgramObject::set_uniform3f(), clan::ProgramObject::set_uniform3i(), clan::ProgramObject::set_uniform3s(), clan::step(), clan::Mat4< Type >::translate(), and clan::Mat4< Type >::translate_self().
| Type clan::Vec3< Type >::z |
Referenced by clan::Vec3< Type >::Vec3(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec3< Type >::dot(), clan::Mat4< Type >::look_at(), clan::Vec3< Type >::operator!=(), clan::Vec3< Type >::operator*=(), clan::Vec3< Type >::operator*=(), clan::Vec3< Type >::operator+=(), clan::Vec3< Type >::operator+=(), clan::Vec3< Type >::operator-(), clan::Vec3< Type >::operator-=(), clan::Vec3< Type >::operator-=(), clan::Vec3< Type >::operator/=(), clan::Vec3< Type >::operator/=(), clan::Vec3< Type >::operator<(), clan::operator<<(), clan::Vec3< Type >::operator=(), clan::Vec3< Type >::operator==(), clan::Mat3< Type >::rotate(), clan::Mat4< Type >::rotate(), clan::Mat4< Type >::scale(), clan::Mat4< Type >::set_translate(), clan::ProgramObject::set_uniform3b(), clan::ProgramObject::set_uniform3f(), clan::ProgramObject::set_uniform3i(), clan::ProgramObject::set_uniform3s(), clan::step(), clan::Mat4< Type >::translate(), and clan::Mat4< Type >::translate_self().