3D vector More...
#include <line_ray.h>
Public Types | |
typedef Type | datatype |
Public Member Functions | |
Vec3 () | |
Vec3 (const Type &scalar) | |
Vec3 (const Vec2< Type > ©, const Type &p3) | |
Vec3 (const Vec4< Type > ©) | |
Vec3 (const Vec3< double > ©) | |
Vec3 (const Vec3< float > ©) | |
Vec3 (const Vec3< int > ©) | |
Vec3 (const Type &p1, const Type &p2, const Type &p3) | |
Vec3 (const Type *array_xyz) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
template<> | |
Vec3 (const Vec3< float > ©) | |
template<> | |
Vec3 (const Vec3< double > ©) | |
template<> | |
Vec3 (const Vec3< int > ©) | |
Angle | angle (const Vec3< Type > &vector) const |
Calculate the angle between this vector and an other vector. More... | |
Angle | angle_normed (const Vec3< Type > &vector) const |
Calculate the angle between this vector and an other vector, where the vectors are unit vectors. More... | |
Vec3< Type > & | cross (const Vec3< Type > &vector) |
Calculate the cross product between this vector and an other vector. More... | |
Type | distance (const Vec3< Type > &vector) const |
Calculate the distance between this vector and an other vector. More... | |
Type | dot (const Vec3< Type > &vector) const |
Dot products this vector with an other vector. More... | |
bool | is_equal (const Vec3< Type > &other, Type epsilon) const |
Returns true if equal within the bounds of an epsilon. More... | |
Type | length () const |
Returns the length (magnitude) of this vector. More... | |
template<> | |
double | length () const |
template<> | |
float | length () const |
Vec3< Type > & | normalize () |
Normalizes this vector. More... | |
bool | operator!= (const Vec3< Type > &vector) const |
!= operator. More... | |
void | operator*= (const Vec3< Type > &vector) |
*= operator. More... | |
void | operator*= (Type value) |
*= operator. More... | |
void | operator+= (const Vec3< Type > &vector) |
+= operator. More... | |
void | operator+= (Type value) |
+= operator. More... | |
Vec3< Type > | operator- () const |
| |
void | operator-= (const Vec3< Type > &vector) |
-= operator. More... | |
void | operator-= (Type value) |
-= operator. More... | |
void | operator/= (const Vec3< Type > &vector) |
/= operator. More... | |
void | operator/= (Type value) |
/= operator. More... | |
bool | operator< (const Vec3< Type > &vector) const |
< operator. More... | |
Vec3< Type > & | operator= (const Vec3< Type > &vector) |
= operator. More... | |
bool | operator== (const Vec3< Type > &vector) const |
== operator. More... | |
Vec3< Type > & | rotate (const Angle &angle, const Vec3< Type > &axis) |
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. More... | |
Vec3< Type > & | round () |
Rounds all components on this vector. More... | |
Static Public Member Functions | |
static Vec3< Type > | cross (const Vec3< Type > &vector1, const Vec3< Type > &vector2) |
Calculate the cross product between two vectors. More... | |
static Type | dot (const Vec3< Type > &vector1, const Vec3< Type > &vector2) |
Dot products between two vectors. More... | |
static bool | is_equal (const Vec3< Type > &first, const Vec3< Type > &second, Type epsilon) |
Returns true if equal within the bounds of an epsilon. More... | |
static Vec3< Type > | normalize (const Vec3< Type > &vector) |
Normalizes a vector. More... | |
static Vec3< Type > | reflect (const Vec3< Type > &incident, const Vec3< Type > &normal) |
Calculate the reflection direction for an incident vector. More... | |
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);. More... | |
static Vec3< Type > | round (const Vec3< 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 | |
}; | |
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 |
|
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. |
|
static |
Calculate the cross product between two vectors.
vector1 | = The first vector |
vector2 | = The second vector |
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. |
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. |
|
inlinestatic |
Dot products between two vectors.
|
inline |
Dot products this vector with an other vector.
Operates in the native datatype
vector | Second vector used for the dot product. |
|
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< int >::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) |
|
inline |
|
inline |
|
inline |
!= operator.
|
inline |
*= operator.
|
inline |
*= operator.
|
inline |
+= operator.
|
inline |
+= operator.
|
inline |
|
inline |
-= operator.
|
inline |
-= operator.
|
inline |
/= operator.
|
inline |
/= operator.
|
inline |
< operator.
|
inline |
= operator.
|
inline |
== operator.
|
static |
Calculate the reflection direction for an incident vector.
Normal vector should be normalized
|
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 >::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 |
Rounds all components on a vector.
Uses Asymmetric Arithmetic Rounding
vector | = Vector to use |
Vec3<Type>& clan::Vec3< Type >::round | ( | ) |
Rounds all components on this vector.
Uses Asymmetric Arithmetic Rounding
union { ... } |
union { ... } |
union { ... } |
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::Vec3< int >::dot(), clan::Mat4< Type >::look_at(), clan::Vec3< int >::operator!=(), clan::Vec3< int >::operator*=(), clan::Vec3< int >::operator+=(), clan::Vec3< int >::operator-(), clan::Vec3< int >::operator-=(), clan::Vec3< int >::operator/=(), clan::Vec3< int >::operator<(), clan::Vec3< int >::operator=(), clan::Vec3< int >::operator==(), clan::Mat3< float >::rotate(), clan::Mat4< Type >::rotate(), clan::Mat3< float >::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(), clan::Mat4< Type >::translate_self(), clan::Vec2< int >::Vec2(), clan::Vec3< int >::Vec3(), and clan::Vec4< float >::Vec4().
Type clan::Vec3< Type >::y |
Referenced by clan::Vec3< int >::dot(), clan::Mat4< Type >::look_at(), clan::Vec3< int >::operator!=(), clan::Vec3< int >::operator*=(), clan::Vec3< int >::operator+=(), clan::Vec3< int >::operator-(), clan::Vec3< int >::operator-=(), clan::Vec3< int >::operator/=(), clan::Vec3< int >::operator<(), clan::Vec3< int >::operator=(), clan::Vec3< int >::operator==(), clan::Mat3< float >::rotate(), clan::Mat4< Type >::rotate(), clan::Mat3< float >::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(), clan::Mat4< Type >::translate_self(), clan::Vec2< int >::Vec2(), clan::Vec3< int >::Vec3(), and clan::Vec4< float >::Vec4().
Type clan::Vec3< Type >::z |
Referenced by clan::Vec3< int >::dot(), clan::Mat4< Type >::look_at(), clan::Vec3< int >::operator!=(), clan::Vec3< int >::operator*=(), clan::Vec3< int >::operator+=(), clan::Vec3< int >::operator-(), clan::Vec3< int >::operator-=(), clan::Vec3< int >::operator/=(), clan::Vec3< int >::operator<(), clan::Vec3< int >::operator=(), clan::Vec3< int >::operator==(), clan::Mat3< float >::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(), clan::Mat4< Type >::translate_self(), clan::Vec3< int >::Vec3(), and clan::Vec4< float >::Vec4().