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 > ©) | |
Type | angle (const Vec3< Type > &vector) const |
Calculate the angle between this vector and an other vector. More... | |
Type | 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 (Type 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, Type 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 | |
Type | x |
Type | y |
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 uicore::Vec3< Type >::datatype |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
uicore::Vec3< Type >::Vec3 | ( | const Vec3< double > & | copy | ) |
uicore::Vec3< Type >::Vec3 | ( | const Vec3< float > & | copy | ) |
uicore::Vec3< Type >::Vec3 | ( | const Vec3< int > & | copy | ) |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
|
inline |
References uicore::Vec3< Type >::x, uicore::x, uicore::Vec3< Type >::y, uicore::y, uicore::Vec3< Type >::z, and uicore::z.
Type uicore::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. |
Type uicore::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>& uicore::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 uicore::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 uicore::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 |
|
inlinestatic |
Normalizes a vector.
vector | = Vector to use |
Operates in the native datatype
|
inline |
Normalizes this vector.
Operates in the native datatype
References uicore::f, uicore::length, uicore::x, uicore::y, and uicore::z.
|
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>& uicore::Vec3< Type >::rotate | ( | Type | 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>& uicore::Vec3< Type >::round | ( | ) |
Rounds all components on this vector.
Uses Asymmetric Arithmetic Rounding
Type uicore::Vec3< Type >::x |
Referenced by uicore::degrees(), uicore::Mat4< Type >::look_at(), uicore::max(), uicore::LineSegment3x< int >::midpoint(), uicore::min(), uicore::normalize_180(), uicore::normalize_2pi(), uicore::normalize_360(), uicore::normalize_pi(), uicore::Vec3< int >::operator-(), uicore::radians(), uicore::Mat3< float >::rotate(), uicore::Mat4< Type >::rotate(), uicore::Mat3< float >::scale(), uicore::Mat4< Type >::scale(), uicore::Mat4< Type >::scale_self(), uicore::Mat4< Type >::set_translate(), uicore::ProgramObject::set_uniform3b(), uicore::ProgramObject::set_uniform3f(), uicore::ProgramObject::set_uniform3i(), uicore::ProgramObject::set_uniform3s(), uicore::ProgramObject::set_uniformfv(), uicore::ProgramObject::set_uniformiv(), uicore::sign(), uicore::step(), uicore::Mat4< Type >::translate(), uicore::Mat4< Type >::translate_self(), uicore::Vec2< int >::Vec2(), uicore::Vec3< Type >::Vec3(), and uicore::Vec4< float >::Vec4().
Type uicore::Vec3< Type >::y |
Referenced by uicore::degrees(), uicore::Mat4< Type >::look_at(), uicore::max(), uicore::LineSegment3x< int >::midpoint(), uicore::min(), uicore::normalize_180(), uicore::normalize_2pi(), uicore::normalize_360(), uicore::normalize_pi(), uicore::Vec3< int >::operator-(), uicore::radians(), uicore::Mat3< float >::rotate(), uicore::Mat4< Type >::rotate(), uicore::Mat3< float >::scale(), uicore::Mat4< Type >::scale(), uicore::Mat4< Type >::scale_self(), uicore::Mat4< Type >::set_translate(), uicore::ProgramObject::set_uniform3b(), uicore::ProgramObject::set_uniform3f(), uicore::ProgramObject::set_uniform3i(), uicore::ProgramObject::set_uniform3s(), uicore::sign(), uicore::step(), uicore::Mat4< Type >::translate(), uicore::Mat4< Type >::translate_self(), uicore::Vec2< int >::Vec2(), uicore::Vec3< Type >::Vec3(), and uicore::Vec4< float >::Vec4().
Type uicore::Vec3< Type >::z |
Referenced by uicore::degrees(), uicore::Mat4< Type >::look_at(), uicore::max(), uicore::LineSegment3x< int >::midpoint(), uicore::min(), uicore::normalize_180(), uicore::normalize_2pi(), uicore::normalize_360(), uicore::normalize_pi(), uicore::Vec3< int >::operator-(), uicore::radians(), uicore::Mat3< float >::rotate(), uicore::Mat4< Type >::rotate(), uicore::Mat4< Type >::scale(), uicore::Mat4< Type >::scale_self(), uicore::Mat4< Type >::set_translate(), uicore::ProgramObject::set_uniform3b(), uicore::ProgramObject::set_uniform3f(), uicore::ProgramObject::set_uniform3i(), uicore::ProgramObject::set_uniform3s(), uicore::sign(), uicore::step(), uicore::Mat4< Type >::translate(), uicore::Mat4< Type >::translate_self(), uicore::Vec3< Type >::Vec3(), and uicore::Vec4< float >::Vec4().