ClanLib
2.3.7
|
2D vector More...
#include <line.h>
Public Types | |
typedef Type | datatype |
Public Member Functions | |
CL_Vec2 () | |
CL_Vec2 (const CL_Vec1< Type > ©) | |
CL_Vec2 (const CL_Vec3< Type > ©) | |
CL_Vec2 (const CL_Vec4< Type > ©) | |
CL_Vec2 (const Type &p1, const Type &p2=0) | |
CL_Vec2 (const Type *array_xy) | |
CL_Vec2 (const CL_Pointx< int > &point) | |
CL_Vec2 (const CL_Pointx< float > &point) | |
CL_Vec2 (const CL_Pointx< double > &point) | |
CL_Vec2 (const CL_Vec2< double > ©) | |
CL_Vec2 (const CL_Vec2< float > ©) | |
CL_Vec2 (const CL_Vec2< int > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< float > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< double > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< int > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< float > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< double > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< int > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< float > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< double > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< int > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< float > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< double > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< int > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< float > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< double > ©) | |
template<> | |
CL_Vec2 (const CL_Vec2< int > ©) | |
Attributes | |
Type | length () const |
Returns the length (magnitude) of this vector. More... | |
CL_Vec2< Type > & | normalize () |
Normalizes this vector. More... | |
Type | dot (const CL_Vec2< Type > &vector) const |
Dot products this vector with an other vector. More... | |
CL_Angle | angle (const CL_Vec2< Type > &vector) const |
Calculate the angle between this vector and an other vector. More... | |
CL_Angle | angle_relative (const CL_Vec2< Type > &vector) const |
Calculate the angle between this vector relative to another vector. More... | |
Type | distance (const CL_Vec2< Type > &vector) const |
Calculate the distance between this vector and an other vector. More... | |
CL_Vec2< Type > & | round () |
Rounds all components of this vector. More... | |
CL_Vec2< Type > & | rotate (const CL_Vec2< Type > &hotspot, const CL_Angle &angle) |
Rotate this vector around another point. More... | |
Type | round_value (float value) const |
Rounds a value for the datatype. More... | |
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. More... | |
void | operator+= (Type value) |
+= operator. More... | |
CL_Vec2< Type > | operator+ (const CL_Vec2< Type > &vector) const |
| |
CL_Vec2< Type > | operator+ (Type value) const |
| |
void | operator-= (const CL_Vec2< Type > &vector) |
-= operator. More... | |
void | operator-= (Type value) |
-= operator. More... | |
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. More... | |
void | operator*= (Type value) |
*= operator. More... | |
CL_Vec2< Type > | operator* (const CL_Vec2< Type > &vector) const |
| |
CL_Vec2< Type > | operator* (Type value) const |
| |
void | operator/= (const CL_Vec2< Type > &vector) |
/= operator. More... | |
void | operator/= (Type value) |
/= operator. More... | |
CL_Vec2< Type > | operator/ (const CL_Vec2< Type > &vector) const |
/ operator. More... | |
CL_Vec2< Type > | operator/ (Type value) const |
/ operator. More... | |
CL_Vec2< Type > & | operator= (const CL_Vec2< Type > &vector) |
= operator. More... | |
bool | operator== (const CL_Vec2< Type > &vector) const |
== operator. More... | |
bool | operator!= (const CL_Vec2< Type > &vector) const |
!= operator. More... | |
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. More... | |
static Type | dot (const CL_Vec2< Type > &vector_1, const CL_Vec2< Type > &vector_2) |
Dot products a vector with an other vector. More... | |
static CL_Vec2< Type > | normalize (const CL_Vec2< Type > &vector) |
Normalizes a vector. More... | |
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. More... | |
static CL_Vec2< Type > | round (const CL_Vec2< Type > &vector) |
Rounds all components on a vector. More... | |
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 |
Returns the anchor point for the origin within the dimensions of the size structure.
origin | = The origin |
size | = The size |
Referenced by CL_Rectx< int >::apply_alignment().
Calculate the distance between this vector and an other vector.
vector | = Second vector used to calculate distance. |
|
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. |
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 |
Normalizes a vector.
Operates in the native datatype
vector | = Vector to use |
Normalizes this vector.
Operates in the native datatype
|
inline |
|
inline |
|
inline |
!= operator.
|
inline |
*= operator.
|
inline |
*= operator.
|
inline |
+= operator.
|
inline |
+= operator.
|
inline |
-= operator.
|
inline |
-= operator.
|
inline |
/ operator.
/ operator.
/= operator.
|
inline |
/= operator.
|
inline |
= operator.
|
inline |
== operator.
|
inline |
|
inline |
|
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 |
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 { ... } |
Type CL_Vec2< Type >::g |
Type CL_Vec2< Type >::r |
Type CL_Vec2< Type >::s |
Type CL_Vec2< Type >::t |
Type CL_Vec2< Type >::x |
Referenced by CL_Rectx< int >::apply_alignment(), CL_Rectx< int >::CL_Rectx(), CL_Vec1< Type >::CL_Vec1(), CL_Vec2< int >::CL_Vec2(), CL_Vec2< float >::CL_Vec2(), CL_Vec2< double >::CL_Vec2(), CL_Vec2< Type >::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!=(), 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_Line2x< int >::point_right_of_line(), CL_LineSegment2x< 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().
Type CL_Vec2< Type >::y |
Referenced by CL_Rectx< int >::apply_alignment(), CL_Rectx< int >::CL_Rectx(), CL_Vec2< int >::CL_Vec2(), CL_Vec2< double >::CL_Vec2(), CL_Vec2< float >::CL_Vec2(), CL_Vec2< Type >::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!=(), 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_Line2x< int >::point_right_of_line(), CL_LineSegment2x< 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().