2D vector More...
#include <vec2.h>
 Inheritance diagram for clan::Vec2< Type >:
 Inheritance diagram for clan::Vec2< Type >:| Public Types | |
| typedef Type | datatype | 
| Public Member Functions | |
| Vec2 () | |
| Vec2 (const Type &p1, const Type &p2) | |
| Vec2 (const Type &scalar) | |
| Vec2 (const Type *array_xy) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< double > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< float > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec2< int > ©) | |
| Vec2 (const Vec3< Type > ©) | |
| Vec2 (const Vec4< Type > ©) | |
| Angle | angle (const Vec2< Type > &vector) const | 
| Calculate the angle between this vector and an other vector. | |
| Angle | angle_line (const Vec2< Type > &point) const | 
| Calculate the angle of the line joining this point and other point. | |
| Angle | angle_normed (const Vec2< Type > &vector) const | 
| Calculate the angle between this vector and an other vector, where the vectors are unit vectors. | |
| Type | distance (const Vec2< Type > &vector) const | 
| Calculate the distance between this vector and an other vector. | |
| Type | dot (const Vec2< Type > &vector) const | 
| Dot products this vector with an other vector. | |
| bool | is_equal (const Vec2< 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 | 
| Vec2< Type > & | normalize () | 
| Normalizes this vector. | |
| bool | operator!= (const Vec2< Type > &vector) const | 
| != operator. | |
| void | operator*= (const Vec2< Type > &vector) | 
| *= operator. | |
| void | operator*= (Type value) | 
| *= operator. | |
| void | operator+= (const Vec2< Type > &vector) | 
| += operator. | |
| void | operator+= (Type value) | 
| += operator. | |
| Vec2< Type > | operator- () const | 
| 
 | |
| void | operator-= (const Vec2< Type > &vector) | 
| -= operator. | |
| void | operator-= (Type value) | 
| -= operator. | |
| void | operator/= (const Vec2< Type > &vector) | 
| /= operator. | |
| void | operator/= (Type value) | 
| /= operator. | |
| bool | operator< (const Vec2< Type > &vector) const | 
| < operator. | |
| Vec2< Type > & | operator= (const Vec2< Type > &vector) | 
| = operator. | |
| bool | operator== (const Vec2< Type > &vector) const | 
| == operator. | |
| Vec2< Type > & | rotate (const Vec2< Type > &hotspot, const Angle &angle) | 
| Rotate this vector around another point. | |
| Vec2< Type > & | round () | 
| Rounds all components of this vector. | |
| Type | round_value (float value) const | 
| Rounds a value for the datatype. | |
| Static Public Member Functions | |
| static Pointx< Type > | calc_origin (Origin origin, const Sizex< Type > &size) | 
| Returns the anchor point for the origin within the dimensions of the size structure. | |
| static Type | dot (const Vec2< Type > &vector_1, const Vec2< Type > &vector_2) | 
| Dot products a vector with an other vector. | |
| static bool | is_equal (const Vec2< Type > &first, const Vec2< Type > &second, Type epsilon) | 
| Returns true if equal within the bounds of an epsilon. | |
| static Vec2< Type > | normalize (const Vec2< Type > &vector) | 
| Normalizes a vector. | |
| static Vec2< Type > | rotate (const Vec2< Type > &vector, const Vec2< Type > &hotspot, const Angle &angle) | 
| Rotate a vector around another point. | |
| static Vec2< Type > | round (const Vec2< Type > &vector) | 
| Rounds all components on a vector. | |
| Public Attributes | ||
| union { | ||
| Type r | ||
| Type s | ||
| Type x | ||
| }; | ||
| union { | ||
| Type g | ||
| Type t | ||
| Type y | ||
| }; | ||
2D vector
These vector templates are defined for:
char (Vec2c), unsigned char (Vec2uc), short (Vec2s),
unsigned short (Vec2us), int (Vec2i), unsigned int (Vec2ui), float (Vec2f), double (Vec2d) 
| typedef Type clan::Vec2< Type >::datatype | 
| 
 | inline | 
Referenced by clan::Vec2< Type >::operator-().
| 
 | inlineexplicit | 
| 
 | inlineexplicit | 
References clan::Vec2< Type >::x, clan::Vec3< Type >::x, clan::Vec2< Type >::y, and clan::Vec3< Type >::y.
| 
 | inlineexplicit | 
References clan::Vec2< Type >::x, clan::Vec4< Type >::x, clan::Vec2< Type >::y, and clan::Vec4< Type >::y.
| 
 | inlineexplicit | 
| 
 | inlineexplicit | 
| clan::Vec2< Type >::Vec2 | ( | const Vec2< double > & | copy | ) | 
| clan::Vec2< Type >::Vec2 | ( | const Vec2< float > & | copy | ) | 
| clan::Vec2< Type >::Vec2 | ( | const Vec2< int > & | copy | ) | 
| 
 | 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::Vec2< Type >::angle | ( | const Vec2< Type > & | vector | ) | const | 
Calculate the angle between this vector and an other vector.
| vector | = Second vector used to calculate angle. | 
| Angle clan::Vec2< Type >::angle_line | ( | const Vec2< Type > & | point | ) | const | 
Calculate the angle of the line joining this point and other point.
| point | = Second point in the line | 
| Angle clan::Vec2< Type >::angle_normed | ( | const Vec2< 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 | 
Returns the anchor point for the origin within the dimensions of the size structure.
| origin | = The origin | 
| size | = The size | 
Referenced by clan::Rectx< Type >::apply_alignment().
| Type clan::Vec2< Type >::distance | ( | const Vec2< 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::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inlinestatic | 
Dot products a vector with an other vector.
Operates in the native datatype
| vector_1 | = First vector used for the dot product. | 
| vector_2 | = 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::Vec2< 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::Vec2< Type >::is_equal().
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
!= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
*= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
*= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
+= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
+= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
References clan::Vec2< Type >::Vec2(), clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
-= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
-= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
/= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
/= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
< operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
= operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| 
 | inline | 
== operator.
References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.
| Vec2< Type > & clan::Vec2< Type >::rotate | ( | const Vec2< Type > & | hotspot, | 
| const Angle & | angle ) | 
Rotate this vector around another point.
| hotspot | The point around which to rotate. | 
| angle | = Angle to rotate. | 
| 
 | static | 
Rotate a vector around another point.
| vector | = Vector to use | 
| hotspot | The point around which to rotate. | 
| angle | = Angle to rotate. | 
| Vec2< Type > & clan::Vec2< Type >::round | ( | ) | 
Rounds all components of this vector.
Uses Asymmetric Arithmetic Rounding
| 
 | static | 
Rounds all components on a vector.
Uses Asymmetric Arithmetic Rounding
| vector | = Vector to use | 
| Type clan::Vec2< Type >::round_value | ( | float | value | ) | const | 
Rounds a value for the datatype.
For doubles and floats, this function does not round.
| value | = Value to round | 
| union { ... } clan::Vec2< Type > | 
| union { ... } clan::Vec2< Type > | 
| Type clan::Vec2< Type >::g | 
| Type clan::Vec2< Type >::r | 
| Type clan::Vec2< Type >::s | 
| Type clan::Vec2< Type >::t | 
| Type clan::Vec2< Type >::x | 
Referenced by clan::Vec2< Type >::Vec2(), clan::Vec2< Type >::Vec2(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec4< Type >::Vec4(), clan::Rectx< Type >::apply_alignment(), clan::Vec2< Type >::dot(), clan::Vec2< Type >::operator!=(), clan::Vec2< Type >::operator*=(), clan::Vec2< Type >::operator*=(), clan::Vec2< Type >::operator+=(), clan::Vec2< Type >::operator+=(), clan::Vec2< Type >::operator-(), clan::Vec2< Type >::operator-=(), clan::Vec2< Type >::operator-=(), clan::Vec2< Type >::operator/=(), clan::Vec2< Type >::operator/=(), clan::Vec2< Type >::operator<(), clan::operator<<(), clan::Vec2< Type >::operator=(), clan::Vec2< Type >::operator==(), clan::ProgramObject::set_uniform2b(), clan::ProgramObject::set_uniform2f(), clan::ProgramObject::set_uniform2i(), clan::ProgramObject::set_uniform2s(), clan::ProgramObject::set_uniformfv(), clan::ProgramObject::set_uniformiv(), clan::Vec4< Type >::set_xy(), clan::Vec4< Type >::set_zw(), clan::step(), and clan::Mat3< Type >::translate().
| Type clan::Vec2< Type >::y | 
Referenced by clan::Vec2< Type >::Vec2(), clan::Vec2< Type >::Vec2(), clan::Vec3< Type >::Vec3(), clan::Vec4< Type >::Vec4(), clan::Vec4< Type >::Vec4(), clan::Rectx< Type >::apply_alignment(), clan::Vec2< Type >::dot(), clan::Vec2< Type >::operator!=(), clan::Vec2< Type >::operator*=(), clan::Vec2< Type >::operator*=(), clan::Vec2< Type >::operator+=(), clan::Vec2< Type >::operator+=(), clan::Vec2< Type >::operator-(), clan::Vec2< Type >::operator-=(), clan::Vec2< Type >::operator-=(), clan::Vec2< Type >::operator/=(), clan::Vec2< Type >::operator/=(), clan::Vec2< Type >::operator<(), clan::operator<<(), clan::Vec2< Type >::operator=(), clan::Vec2< Type >::operator==(), clan::ProgramObject::set_uniform2b(), clan::ProgramObject::set_uniform2f(), clan::ProgramObject::set_uniform2i(), clan::ProgramObject::set_uniform2s(), clan::Vec4< Type >::set_xy(), clan::Vec4< Type >::set_zw(), clan::step(), and clan::Mat3< Type >::translate().