2D vector More...
#include <vec2.h>

Public Types | |
| typedef Type | datatype |
Public Member Functions | |
| CL_Vec2 () | |
| template<> | |
| CL_Vec2 (const CL_Vec2< int > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< double > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< float > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< int > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< double > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< float > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< int > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< double > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< float > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< int > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< double > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< float > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< int > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< double > ©) | |
| template<> | |
| CL_Vec2 (const CL_Vec2< float > ©) | |
| CL_Vec2 (const CL_Vec2< int > ©) | |
| CL_Vec2 (const CL_Vec2< float > ©) | |
| CL_Vec2 (const CL_Vec2< double > ©) | |
| CL_Vec2 (const CL_Pointx< double > &point) | |
| CL_Vec2 (const CL_Pointx< float > &point) | |
| CL_Vec2 (const CL_Pointx< int > &point) | |
| CL_Vec2 (const Type *array_xy) | |
| CL_Vec2 (const Type &p1, const Type &p2=0) | |
| CL_Vec2 (const CL_Vec4< Type > ©) | |
| CL_Vec2 (const CL_Vec3< Type > ©) | |
| CL_Vec2 (const CL_Vec1< Type > ©) | |
Attributes | |
| Type | length () const |
| Returns the length (magnitude) of this vector. | |
| CL_Vec2< Type > & | normalize () |
| Normalizes this vector. | |
| Type | dot (const CL_Vec2< Type > &vector) const |
| Dot products this vector with an other vector. | |
| CL_Angle | angle (const CL_Vec2< Type > &vector) const |
| Calculate the angle between this vector and an other vector. | |
| CL_Angle | angle_relative (const CL_Vec2< Type > &vector) const |
| Calculate the angle between this vector relative to another vector. | |
| Type | distance (const CL_Vec2< Type > &vector) const |
| Calculate the distance between this vector and an other vector. | |
| CL_Vec2< Type > & | round () |
| Rounds all components of this vector. | |
| CL_Vec2< Type > & | rotate (const CL_Vec2< Type > &hotspot, const CL_Angle &angle) |
| Rotate this vector around another point. | |
| Type | round_value (float value) const |
| Rounds a value for the datatype. | |
Operators | |
| const Type & | operator[] (unsigned int i) const |
| Type & | operator[] (unsigned int i) |
| operator Type * () | |
| operator Type *const () const | |
| void | operator+= (const CL_Vec2< Type > &vector) |
| += operator. | |
| void | operator+= (Type value) |
| += operator. | |
| CL_Vec2< Type > | operator+ (const CL_Vec2< Type > &vector) const |
| + operator. | |
| CL_Vec2< Type > | operator+ (Type value) const |
| + operator. | |
| void | operator-= (const CL_Vec2< Type > &vector) |
| -= operator. | |
| void | operator-= (Type value) |
| -= operator. | |
| CL_Vec2< Type > | operator- (const CL_Vec2< Type > &vector) const |
| |
| CL_Vec2< Type > | operator- (Type value) const |
| |
| CL_Vec2< Type > | operator- () const |
| |
| void | operator*= (const CL_Vec2< Type > &vector) |
| *= operator. | |
| void | operator*= (Type value) |
| *= operator. | |
| CL_Vec2< Type > | operator* (const CL_Vec2< Type > &vector) const |
| * operator. | |
| CL_Vec2< Type > | operator* (Type value) const |
| * operator. | |
| void | operator/= (const CL_Vec2< Type > &vector) |
| /= operator. | |
| void | operator/= (Type value) |
| /= operator. | |
| CL_Vec2< Type > | operator/ (const CL_Vec2< Type > &vector) const |
| / operator. | |
| CL_Vec2< Type > | operator/ (Type value) const |
| / operator. | |
| CL_Vec2< Type > & | operator= (const CL_Vec2< Type > &vector) |
| = operator. | |
| bool | operator== (const CL_Vec2< Type > &vector) const |
| == operator. | |
| bool | operator!= (const CL_Vec2< Type > &vector) const |
| != operator. | |
Static Public Member Functions | |
| static CL_Pointx< Type > | calc_origin (CL_Origin origin, const CL_Sizex< Type > &size) |
| Returns the anchor point for the origin within the dimensions of the size structure. | |
| static Type | dot (const CL_Vec2< Type > &vector_1, const CL_Vec2< Type > &vector_2) |
| Dot products a vector with an other vector. | |
| static CL_Vec2< Type > | normalize (const CL_Vec2< Type > &vector) |
| Normalizes a vector. | |
| static CL_Vec2< Type > | rotate (const CL_Vec2< Type > &vector, const CL_Vec2< Type > &hotspot, const CL_Angle &angle) |
| Rotate a vector around another point. | |
| static CL_Vec2< Type > | round (const CL_Vec2< Type > &vector) |
| Rounds all components on a vector. | |
Public Attributes | |
| union { | |
| Type g | |
| Type t | |
| Type y | |
| }; | |
| union { | |
| Type r | |
| Type s | |
| Type x | |
| }; | |
2D vector
These vector templates are defined for:
char (CL_Vec2c), unsigned char (CL_Vec2uc), short (CL_Vec2s),
unsigned short (CL_Vec2us), int (CL_Vec2i), unsigned int (CL_Vec2ui), float (CL_Vec2f), double (CL_Vec2d)
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.
Calculate the angle between this vector and an other vector.
| vector | = Second vector used to calculate angle. |
| CL_Angle CL_Vec2< Type >::angle_relative | ( | const CL_Vec2< Type > & | vector | ) | const |
Calculate the angle between this vector relative to another vector.
| vector | = Second vector used to calculate angle. |
| static CL_Pointx<Type> CL_Vec2< Type >::calc_origin | ( | CL_Origin | origin, | |
| const CL_Sizex< Type > & | size | |||
| ) | [static] |
Returns the anchor point for the origin within the dimensions of the size structure.
| origin | = The origin | |
| size | = The size |
Calculate the distance between this vector and an other vector.
| vector | = Second vector used to calculate distance. |
| static Type CL_Vec2< Type >::dot | ( | const CL_Vec2< Type > & | vector_1, | |
| const CL_Vec2< Type > & | vector_2 | |||
| ) | [inline, static] |
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. |
Dot products this vector with an other vector.
Operates in the native datatype
| vector | Second vector used for the dot product. |
| Type CL_Vec2< Type >::length | ( | ) | const |
Returns the length (magnitude) of this vector.
Operates in the native datatype
| static CL_Vec2<Type> CL_Vec2< Type >::normalize | ( | const CL_Vec2< Type > & | vector | ) | [static] |
Normalizes a vector.
Operates in the native datatype
| vector | = Vector to use |
Normalizes this vector.
Operates in the native datatype
| CL_Vec2< Type >::operator Type * | ( | ) | [inline] |
| CL_Vec2< Type >::operator Type *const | ( | ) | const [inline] |
| bool CL_Vec2< Type >::operator!= | ( | const CL_Vec2< Type > & | vector | ) | const [inline] |
!= operator.
| CL_Vec2<Type> CL_Vec2< Type >::operator* | ( | const CL_Vec2< Type > & | vector | ) | const [inline] |
* operator.
* operator.
| void CL_Vec2< Type >::operator*= | ( | Type | value | ) | [inline] |
*= operator.
| void CL_Vec2< Type >::operator*= | ( | const CL_Vec2< Type > & | vector | ) | [inline] |
*= operator.
| CL_Vec2<Type> CL_Vec2< Type >::operator+ | ( | const CL_Vec2< Type > & | vector | ) | const [inline] |
+ operator.
+ operator.
| void CL_Vec2< Type >::operator+= | ( | Type | value | ) | [inline] |
+= operator.
| void CL_Vec2< Type >::operator+= | ( | const CL_Vec2< Type > & | vector | ) | [inline] |
+= operator.
| CL_Vec2<Type> CL_Vec2< Type >::operator- | ( | const CL_Vec2< Type > & | vector | ) | const [inline] |
| void CL_Vec2< Type >::operator-= | ( | const CL_Vec2< Type > & | vector | ) | [inline] |
-= operator.
| void CL_Vec2< Type >::operator-= | ( | Type | value | ) | [inline] |
-= operator.
/ operator.
| CL_Vec2<Type> CL_Vec2< Type >::operator/ | ( | const CL_Vec2< Type > & | vector | ) | const [inline] |
/ operator.
| void CL_Vec2< Type >::operator/= | ( | const CL_Vec2< Type > & | vector | ) | [inline] |
/= operator.
| void CL_Vec2< Type >::operator/= | ( | Type | value | ) | [inline] |
/= operator.
| CL_Vec2<Type>& CL_Vec2< Type >::operator= | ( | const CL_Vec2< Type > & | vector | ) | [inline] |
= operator.
| bool CL_Vec2< Type >::operator== | ( | const CL_Vec2< Type > & | vector | ) | const [inline] |
== operator.
| Type& CL_Vec2< Type >::operator[] | ( | unsigned int | i | ) | [inline] |
| const Type& CL_Vec2< Type >::operator[] | ( | unsigned int | i | ) | const [inline] |
| static CL_Vec2<Type> CL_Vec2< Type >::rotate | ( | const CL_Vec2< Type > & | vector, | |
| const CL_Vec2< Type > & | hotspot, | |||
| const CL_Angle & | angle | |||
| ) | [static] |
Rotate a vector around another point.
| vector | = Vector to use | |
| hotspot | The point around which to rotate. | |
| angle | = Angle to rotate. |
| CL_Vec2<Type>& CL_Vec2< Type >::rotate | ( | const CL_Vec2< Type > & | hotspot, | |
| const CL_Angle & | angle | |||
| ) |
Rotate this vector around another point.
| hotspot | The point around which to rotate. | |
| angle | = Angle to rotate. |
| static CL_Vec2<Type> CL_Vec2< Type >::round | ( | const CL_Vec2< Type > & | vector | ) | [static] |
Rounds all components on a vector.
Uses Asymmetric Arithmetic Rounding
| vector | = Vector to use |
Rounds all components of this vector.
Uses Asymmetric Arithmetic Rounding
| Type CL_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 { ... } |
| union { ... } |
Referenced by CL_Rectx< int >::apply_alignment(), CL_Quadx< int >::CL_Quadx(), CL_Rectx< int >::CL_Rectx(), CL_Vec1< Type >::CL_Vec1(), CL_Vec2< double >::CL_Vec2(), CL_Vec2< float >::CL_Vec2(), CL_Vec2< Type >::CL_Vec2(), CL_Vec2< int >::CL_Vec2(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_OutlineCircle::collide(), CL_Rectx< int >::contains(), CL_Vec2< int >::dot(), CL_Vec2< int >::operator!=(), operator*(), CL_Vec2< int >::operator*(), CL_Vec2< int >::operator*=(), CL_Vec2< int >::operator+(), CL_Vec2< int >::operator+=(), CL_Vec2< int >::operator-(), CL_Vec2< int >::operator-=(), CL_Vec2< int >::operator/(), CL_Vec2< int >::operator/=(), CL_Vec2< int >::operator=(), CL_Vec2< int >::operator==(), CL_LineSegment2x< int >::point_right_of_line(), CL_Line2x< int >::point_right_of_line(), CL_Rectx< int >::set_bottom_left(), CL_Rectx< int >::set_bottom_right(), CL_Rectx< int >::set_top_left(), CL_Rectx< int >::set_top_right(), CL_ProgramObject::set_uniform2b(), CL_ProgramObject::set_uniform2f(), CL_ProgramObject::set_uniform2i(), CL_ProgramObject::set_uniform2s(), and CL_Rectx< int >::translate().
Referenced by CL_Rectx< int >::apply_alignment(), CL_Rectx< int >::CL_Rectx(), CL_Vec2< double >::CL_Vec2(), CL_Vec2< float >::CL_Vec2(), CL_Vec2< Type >::CL_Vec2(), CL_Vec2< int >::CL_Vec2(), CL_Vec3< int >::CL_Vec3(), CL_Vec4< Type >::CL_Vec4(), CL_OutlineCircle::collide(), CL_Rectx< int >::contains(), CL_Vec2< int >::dot(), CL_Vec2< int >::operator!=(), operator*(), CL_Vec2< int >::operator*(), CL_Vec2< int >::operator*=(), CL_Vec2< int >::operator+(), CL_Vec2< int >::operator+=(), CL_Vec2< int >::operator-(), CL_Vec2< int >::operator-=(), CL_Vec2< int >::operator/(), CL_Vec2< int >::operator/=(), CL_Vec2< int >::operator=(), CL_Vec2< int >::operator==(), CL_LineSegment2x< int >::point_right_of_line(), CL_Line2x< int >::point_right_of_line(), CL_Rectx< int >::set_bottom_left(), CL_Rectx< int >::set_bottom_right(), CL_Rectx< int >::set_top_left(), CL_Rectx< int >::set_top_right(), CL_ProgramObject::set_uniform2b(), CL_ProgramObject::set_uniform2f(), CL_ProgramObject::set_uniform2i(), CL_ProgramObject::set_uniform2s(), and CL_Rectx< int >::translate().
1.7.1