2D vector More...
#include <line.h>
Public Types | |
typedef Type | datatype |
Public Member Functions | |
Vec2 () | |
Vec2 (const Type &scalar) | |
Vec2 (const Vec3< Type > ©) | |
Vec2 (const Vec4< Type > ©) | |
Vec2 (const Type &p1, const Type &p2) | |
Vec2 (const Type *array_xy) | |
Vec2 (const Vec2< double > ©) | |
Vec2 (const Vec2< float > ©) | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
template<> | |
Vec2 (const Vec2< float > ©) | |
template<> | |
Vec2 (const Vec2< double > ©) | |
template<> | |
Vec2 (const Vec2< int > ©) | |
Type | angle (const Vec2< Type > &vector) const |
Calculate the angle between this vector and an other vector. More... | |
Type | angle_line (const Vec2< Type > &point) const |
Calculate the angle of the line joining this point and other point. More... | |
Type | angle_normed (const Vec2< Type > &vector) const |
Calculate the angle between this vector and an other vector, where the vectors are unit vectors. More... | |
Type | distance (const Vec2< Type > &vector) const |
Calculate the distance between this vector and an other vector. More... | |
Type | dot (const Vec2< Type > &vector) const |
Dot products this vector with an other vector. More... | |
bool | is_equal (const Vec2< 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 |
Vec2< Type > & | normalize () |
Normalizes this vector. More... | |
bool | operator!= (const Vec2< Type > &vector) const |
!= operator. More... | |
void | operator*= (const Vec2< Type > &vector) |
*= operator. More... | |
void | operator*= (Type value) |
*= operator. More... | |
void | operator+= (const Vec2< Type > &vector) |
+= operator. More... | |
void | operator+= (Type value) |
+= operator. More... | |
Vec2< Type > | operator- () const |
| |
void | operator-= (const Vec2< Type > &vector) |
-= operator. More... | |
void | operator-= (Type value) |
-= operator. More... | |
void | operator/= (const Vec2< Type > &vector) |
/= operator. More... | |
void | operator/= (Type value) |
/= operator. More... | |
bool | operator< (const Vec2< Type > &vector) const |
< operator. More... | |
Vec2< Type > & | operator= (const Vec2< Type > &vector) |
= operator. More... | |
bool | operator== (const Vec2< Type > &vector) const |
== operator. More... | |
Vec2< Type > & | rotate (const Vec2< Type > &hotspot, Type angle) |
Rotate this vector around another point. More... | |
Vec2< Type > & | round () |
Rounds all components of this vector. More... | |
Type | round_value (float value) const |
Rounds a value for the datatype. More... | |
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. More... | |
static Type | dot (const Vec2< Type > &vector_1, const Vec2< Type > &vector_2) |
Dot products a vector with an other vector. More... | |
static bool | is_equal (const Vec2< Type > &first, const Vec2< Type > &second, Type epsilon) |
Returns true if equal within the bounds of an epsilon. More... | |
static Vec2< Type > | normalize (const Vec2< Type > &vector) |
Normalizes a vector. More... | |
static Vec2< Type > | rotate (const Vec2< Type > &vector, const Vec2< Type > &hotspot, Type angle) |
Rotate a vector around another point. More... | |
static Vec2< Type > | round (const Vec2< Type > &vector) |
Rounds all components on a vector. More... | |
Public Attributes | |
Type | x |
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 uicore::Vec2< Type >::datatype |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
uicore::Vec2< Type >::Vec2 | ( | const Vec2< double > & | copy | ) |
uicore::Vec2< Type >::Vec2 | ( | const Vec2< float > & | copy | ) |
uicore::Vec2< Type >::Vec2 | ( | const Vec2< int > & | copy | ) |
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
|
inline |
References uicore::Vec2< Type >::x, uicore::x, uicore::Vec2< Type >::y, and uicore::y.
Type uicore::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. |
Type uicore::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 |
Type uicore::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 uicore::Rectx< int >::apply_alignment().
Type uicore::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. |
Referenced by uicore::Circlex< int >::is_inside().
|
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. |
|
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::Vec2< 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.
Operates in the native datatype
vector | = Vector to use |
|
inline |
Normalizes this vector.
Operates in the native datatype
References uicore::f, uicore::length, uicore::x, and uicore::y.
|
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 |
Rotate a vector around another point.
vector | = Vector to use |
hotspot | The point around which to rotate. |
angle | = Angle to rotate. |
Vec2<Type>& uicore::Vec2< Type >::rotate | ( | const Vec2< Type > & | hotspot, |
Type | 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 |
Vec2<Type>& uicore::Vec2< Type >::round | ( | ) |
Rounds all components of this vector.
Uses Asymmetric Arithmetic Rounding
Type uicore::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 |
Type uicore::Vec2< Type >::x |
Referenced by uicore::Rectx< int >::apply_alignment(), uicore::Rectx< int >::contains(), uicore::Texture2D::copy_subimage_from(), uicore::degrees(), uicore::max(), uicore::LineSegment2x< int >::midpoint(), uicore::min(), uicore::normalize_180(), uicore::normalize_2pi(), uicore::normalize_360(), uicore::normalize_pi(), uicore::Vec2< int >::operator-(), uicore::Line2x< int >::point_right_of_line(), uicore::LineSegment2x< int >::point_right_of_line(), uicore::radians(), uicore::Rectx< int >::set_position(), uicore::TextureCubeArray::set_subimage(), uicore::TextureCube::set_subimage(), uicore::Texture2DArray::set_subimage(), uicore::Texture2D::set_subimage(), uicore::ProgramObject::set_uniform2b(), uicore::ProgramObject::set_uniform2f(), uicore::ProgramObject::set_uniform2i(), uicore::ProgramObject::set_uniform2s(), uicore::ProgramObject::set_uniformfv(), uicore::ProgramObject::set_uniformiv(), uicore::Vec4< float >::set_xy(), uicore::Vec4< float >::set_zw(), uicore::sign(), uicore::step(), uicore::Mat3< float >::translate(), uicore::Rectx< int >::translate(), uicore::Vec2< Type >::Vec2(), uicore::Vec3< int >::Vec3(), uicore::Vec4< float >::Vec4(), and uicore::Rectx< int >::xywh().
Type uicore::Vec2< Type >::y |
Referenced by uicore::Rectx< int >::apply_alignment(), uicore::Rectx< int >::contains(), uicore::Texture2D::copy_subimage_from(), uicore::degrees(), uicore::max(), uicore::LineSegment2x< int >::midpoint(), uicore::min(), uicore::normalize_180(), uicore::normalize_2pi(), uicore::normalize_360(), uicore::normalize_pi(), uicore::Vec2< int >::operator-(), uicore::Line2x< int >::point_right_of_line(), uicore::LineSegment2x< int >::point_right_of_line(), uicore::radians(), uicore::Rectx< int >::set_position(), uicore::TextureCubeArray::set_subimage(), uicore::TextureCube::set_subimage(), uicore::Texture2DArray::set_subimage(), uicore::Texture2D::set_subimage(), uicore::ProgramObject::set_uniform2b(), uicore::ProgramObject::set_uniform2f(), uicore::ProgramObject::set_uniform2i(), uicore::ProgramObject::set_uniform2s(), uicore::Vec4< float >::set_xy(), uicore::Vec4< float >::set_zw(), uicore::sign(), uicore::step(), uicore::Mat3< float >::translate(), uicore::Rectx< int >::translate(), uicore::Vec2< Type >::Vec2(), uicore::Vec3< int >::Vec3(), uicore::Vec4< float >::Vec4(), and uicore::Rectx< int >::xywh().