4D vector More...
#include <vec4.h>
Public Types | |
typedef Type | datatype |
Public Member Functions | |
Vec4 () | |
Vec4 (const Type &p1, const Type &p2, const Type &p3, const Type &p4) | |
Vec4 (const Type &p1, const Type &p2, const Vec2< Type > ©34) | |
Vec4 (const Type &scalar) | |
Vec4 (const Type *array_xyzw) | |
Vec4 (const Vec2< Type > ©, const Type &p3, const Type &p4) | |
Vec4 (const Vec2< Type > ©, const Vec2< Type > ©34) | |
Vec4 (const Vec3< Type > ©, const Type &p4) | |
Angle | angle3 (const Vec4< Type > &vector) const |
Calculate the angle between this vector and an other vector (not taking into account the w ordinate). | |
Vec4< Type > & | cross3 (const Vec4< Type > &vector) |
Calculate the cross product between this vector and an other vector (not taking into account the w ordinate). | |
Type | distance3 (const Vec4< Type > &vector) const |
Calculate the distance between this vector and an other vector (not taking into account the w ordinate). | |
Type | distance4 (const Vec4< Type > &vector) const |
Calculate the distance between this vector and an other vector (taking into account the w ordinate). | |
Type | dot3 (const Vec4< Type > &vector) const |
Dot products this vector with an other vector (not taking into account the w ordinate). | |
Type | dot4 (const Vec4< Type > &vector) const |
Dot products this vector with an other vector (taking into account the w ordinate). | |
bool | is_equal (const Vec4< Type > &other, Type epsilon) const |
Returns true if equal within the bounds of an epsilon. | |
Type | length3 () const |
Returns the length (magnitude) of this vector (not taking into account the w ordinate). | |
double | length3 () const |
float | length3 () const |
Type | length4 () const |
Returns the length (magnitude) of this vector (taking into account the w ordinate). | |
double | length4 () const |
float | length4 () const |
Vec4< Type > & | normalize3 () |
Normalizes this vector (not taking into account the w ordinate) | |
Vec4< Type > & | normalize4 () |
Normalizes this vector (taking into account the w ordinate) | |
bool | operator!= (const Vec4< Type > &vector) const |
!= operator. | |
void | operator*= (const Vec4< Type > &vector) |
*= operator. | |
void | operator*= (Type value) |
*= operator. | |
void | operator+= (const Vec4< Type > &vector) |
+= operator. | |
void | operator+= (Type value) |
+= operator. | |
Vec4< Type > | operator- () const |
| |
void | operator-= (const Vec4< Type > &vector) |
-= operator. | |
void | operator-= (Type value) |
-= operator. | |
void | operator/= (const Vec4< Type > &vector) |
/= operator. | |
void | operator/= (Type value) |
/= operator. | |
bool | operator< (const Vec4< Type > &vector) const |
< operator. | |
Vec4< Type > & | operator= (const Vec4< Type > &vector) |
= operator. | |
bool | operator== (const Vec4< Type > &vector) const |
== operator. | |
Vec4< Type > & | rotate3 (const Angle &angle, const Vec4< Type > &axis) |
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. | |
Vec4< Type > & | round () |
Rounds all components on this vector. | |
void | set_xy (const Vec2< Type > &new_v) |
void | set_zw (const Vec2< Type > &new_v) |
Static Public Member Functions | |
static Vec4< Type > | cross3 (const Vec4< Type > &vector1, const Vec4< Type > &vector2) |
Calculate the cross product between two vectors (not taking into account the w ordinate). | |
static Type | dot3 (const Vec4< Type > &vector1, const Vec4< Type > &vector2) |
Dot products between two vectors (not taking into account the w ordinate). | |
static Type | dot4 (const Vec4< Type > &vector1, const Vec4< Type > &vector2) |
Dot products between two vectors (taking into account the w ordinate). | |
static bool | is_equal (const Vec4< Type > &first, const Vec4< Type > &second, Type epsilon) |
Returns true if equal within the bounds of an epsilon. | |
static Vec4< Type > | normalize3 (const Vec4< Type > &vector) |
Normalizes a vector (not taking into account the w ordinate) | |
static Vec4< Type > | normalize4 (const Vec4< Type > &vector) |
Normalizes a vector (taking into account the w ordinate) | |
static Vec4< Type > | rotate3 (const Vec4< Type > &vector, const Angle &angle, const Vec4< Type > &axis) |
Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. | |
static Vec4< Type > | round (const Vec4< 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 | |
}; | |
union { | |
Type a | |
Type v | |
Type w | |
}; | |
4D vector
These vector templates are defined for:
char (Vec4c), unsigned char (Vec4uc), short (Vec4s),
unsigned short (Vec4us), int (Vec4i), unsigned int (Vec4ui), float (Vec4f), double (Vec4d)
typedef Type clan::Vec4< Type >::datatype |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Angle clan::Vec4< Type >::angle3 | ( | const Vec4< Type > & | vector | ) | const |
Calculate the angle between this vector and an other vector (not taking into account the w ordinate).
vector | = Second vector used to calculate angle. |
Vec4< Type > & clan::Vec4< Type >::cross3 | ( | const Vec4< Type > & | 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. |
|
static |
Calculate the cross product between two vectors (not taking into account the w ordinate).
\vector1 = The first vector \vector2 = The second vector
Type clan::Vec4< Type >::distance3 | ( | const Vec4< Type > & | vector | ) | const |
Calculate the distance between this vector and an other vector (not taking into account the w ordinate).
vector | = Second vector used to calculate distance. |
Type clan::Vec4< Type >::distance4 | ( | const Vec4< Type > & | vector | ) | const |
Calculate the distance between this vector and an other vector (taking into account the w ordinate).
vector | = Second vector used to calculate distance. |
|
inline |
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 clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
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 clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
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 clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::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 clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
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) |
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
Referenced by clan::Vec4< 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::Vec4< Type >::is_equal().
|
inline |
|
inline |
|
inline |
|
inline |
Vec4< Type > & clan::Vec4< Type >::normalize3 | ( | ) |
Normalizes this vector (not 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 |
Vec4< Type > & clan::Vec4< Type >::normalize4 | ( | ) |
Normalizes this vector (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 |
|
inline |
!= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
*= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
*= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
+= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
+= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
-= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
-= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
/= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
/= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
< operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
= operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
|
inline |
== operator.
References clan::Vec4< Type >::w, clan::Vec4< Type >::x, clan::Vec4< Type >::y, and clan::Vec4< Type >::z.
Vec4< Type > & clan::Vec4< Type >::rotate3 | ( | const Angle & | angle, |
const 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 |
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. |
Vec4< Type > & clan::Vec4< Type >::round | ( | ) |
Rounds all components on this vector.
Includes the w ordinate
Uses Asymmetric Arithmetic Rounding
|
static |
Rounds all components on a vector.
Includes the w ordinate
Uses Asymmetric Arithmetic Rounding
vector | = The vector to use |
|
inline |
References clan::Vec2< Type >::x, clan::Vec4< Type >::x, clan::Vec2< Type >::y, and clan::Vec4< Type >::y.
|
inline |
References clan::Vec4< Type >::w, clan::Vec2< Type >::x, clan::Vec2< Type >::y, and clan::Vec4< Type >::z.
union { ... } clan::Vec4< Type >::@17 |
union { ... } clan::Vec4< Type >::@19 |
union { ... } clan::Vec4< Type >::@21 |
union { ... } clan::Vec4< Type >::@23 |
Type clan::Vec4< Type >::a |
Referenced by clan::Color::get_abgr8(), clan::Color::get_alpha(), clan::Color::get_alpha_f(), clan::Color::get_argb8(), clan::Color::get_bgra8(), clan::Color::get_rgba8(), clan::Color::operator!=(), clan::Color::operator==(), clan::Color::set_alpha(), clan::Color::set_alpha_f(), clan::Color::set_color(), and clan::Color::set_colorf().
Type clan::Vec4< Type >::b |
Referenced by clan::Color::get_abgr8(), clan::Color::get_argb8(), clan::Color::get_bgr8(), clan::Color::get_bgra8(), clan::Color::get_blue(), clan::Color::get_blue_f(), clan::Color::get_rgba8(), clan::Color::operator!=(), clan::Color::operator==(), clan::Color::set_blue(), clan::Color::set_blue_f(), clan::Color::set_color(), and clan::Color::set_colorf().
Type clan::Vec4< Type >::g |
Referenced by clan::Color::get_abgr8(), clan::Color::get_argb8(), clan::Color::get_bgr8(), clan::Color::get_bgra8(), clan::Color::get_green(), clan::Color::get_green_f(), clan::Color::get_rgba8(), clan::Color::operator!=(), clan::Color::operator==(), clan::Color::set_color(), clan::Color::set_colorf(), clan::Color::set_green(), and clan::Color::set_green_f().
Type clan::Vec4< Type >::r |
Referenced by clan::Color::get_abgr8(), clan::Color::get_argb8(), clan::Color::get_bgr8(), clan::Color::get_bgra8(), clan::Color::get_red(), clan::Color::get_red_f(), clan::Color::get_rgba8(), clan::Color::operator!=(), clan::Color::operator==(), clan::Color::set_color(), clan::Color::set_colorf(), clan::Color::set_red(), and clan::Color::set_red_f().
Type clan::Vec4< Type >::s |
Type clan::Vec4< Type >::t |
Type clan::Vec4< Type >::u |
Type clan::Vec4< Type >::v |
Type clan::Vec4< Type >::w |
Referenced by clan::Vec4< Type >::Vec4(), clan::Vec4< Type >::dot4(), clan::Vec4< Type >::is_equal(), clan::Vec4< Type >::operator!=(), clan::operator*(), clan::Vec4< Type >::operator*=(), clan::operator+(), clan::Vec4< Type >::operator+=(), clan::Vec4< Type >::operator-(), clan::operator-(), clan::Vec4< Type >::operator-=(), clan::operator/(), clan::Vec4< Type >::operator/=(), clan::Vec4< Type >::operator<(), clan::operator<<(), clan::Vec4< Type >::operator=(), clan::Vec4< Type >::operator==(), clan::ProgramObject::set_uniform4b(), clan::ProgramObject::set_uniform4f(), clan::ProgramObject::set_uniform4i(), clan::ProgramObject::set_uniform4s(), clan::Vec4< Type >::set_zw(), and clan::step().
Type clan::Vec4< Type >::x |
Referenced by clan::Vec2< Type >::Vec2(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec4< Type >::dot3(), clan::Vec4< Type >::dot4(), clan::Vec4< Type >::is_equal(), clan::Vec4< Type >::operator!=(), clan::operator*(), clan::Vec4< Type >::operator*=(), clan::operator+(), clan::Vec4< Type >::operator+=(), clan::Vec4< Type >::operator-(), clan::operator-(), clan::Vec4< Type >::operator-=(), clan::operator/(), clan::Vec4< Type >::operator/=(), clan::Vec4< Type >::operator<(), clan::operator<<(), clan::Vec4< Type >::operator=(), clan::Vec4< Type >::operator==(), clan::ProgramObject::set_uniform4b(), clan::ProgramObject::set_uniform4f(), clan::ProgramObject::set_uniform4i(), clan::ProgramObject::set_uniform4s(), clan::ProgramObject::set_uniformfv(), clan::ProgramObject::set_uniformiv(), clan::Vec4< Type >::set_xy(), and clan::step().
Type clan::Vec4< Type >::y |
Referenced by clan::Vec2< Type >::Vec2(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec4< Type >::dot3(), clan::Vec4< Type >::dot4(), clan::Vec4< Type >::is_equal(), clan::Vec4< Type >::operator!=(), clan::operator*(), clan::Vec4< Type >::operator*=(), clan::operator+(), clan::Vec4< Type >::operator+=(), clan::Vec4< Type >::operator-(), clan::operator-(), clan::Vec4< Type >::operator-=(), clan::operator/(), clan::Vec4< Type >::operator/=(), clan::Vec4< Type >::operator<(), clan::operator<<(), clan::Vec4< Type >::operator=(), clan::Vec4< Type >::operator==(), clan::ProgramObject::set_uniform4b(), clan::ProgramObject::set_uniform4f(), clan::ProgramObject::set_uniform4i(), clan::ProgramObject::set_uniform4s(), clan::Vec4< Type >::set_xy(), and clan::step().
Type clan::Vec4< Type >::z |
Referenced by clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec4< Type >::dot3(), clan::Vec4< Type >::dot4(), clan::Vec4< Type >::is_equal(), clan::Vec4< Type >::operator!=(), clan::operator*(), clan::Vec4< Type >::operator*=(), clan::operator+(), clan::Vec4< Type >::operator+=(), clan::Vec4< Type >::operator-(), clan::operator-(), clan::Vec4< Type >::operator-=(), clan::operator/(), clan::Vec4< Type >::operator/=(), clan::Vec4< Type >::operator<(), clan::operator<<(), clan::Vec4< Type >::operator=(), clan::Vec4< Type >::operator==(), clan::ProgramObject::set_uniform4b(), clan::ProgramObject::set_uniform4f(), clan::ProgramObject::set_uniform4i(), clan::ProgramObject::set_uniform4s(), clan::Vec4< Type >::set_zw(), and clan::step().