|
(Note that these are not member functions.)
|
template<typename T > |
Vector2< T > | operator- (const Vector2< T > &right) |
| Overload of unary operator -. More...
|
|
template<typename T > |
Vector2< T > & | operator+= (Vector2< T > &left, const Vector2< T > &right) |
| Overload of binary operator +=. More...
|
|
template<typename T > |
Vector2< T > & | operator-= (Vector2< T > &left, const Vector2< T > &right) |
| Overload of binary operator -=. More...
|
|
template<typename T > |
Vector2< T > | operator+ (const Vector2< T > &left, const Vector2< T > &right) |
| Overload of binary operator +. More...
|
|
template<typename T > |
Vector2< T > | operator- (const Vector2< T > &left, const Vector2< T > &right) |
| Overload of binary operator -. More...
|
|
template<typename T > |
Vector2< T > | operator* (const Vector2< T > &left, T right) |
| Overload of binary operator *. More...
|
|
template<typename T > |
Vector2< T > | operator* (T left, const Vector2< T > &right) |
| Overload of binary operator *. More...
|
|
template<typename T > |
Vector2< T > & | operator*= (Vector2< T > &left, T right) |
| Overload of binary operator *=. More...
|
|
template<typename T > |
Vector2< T > | operator/ (const Vector2< T > &left, T right) |
| Overload of binary operator /. More...
|
|
template<typename T > |
Vector2< T > & | operator/= (Vector2< T > &left, T right) |
| Overload of binary operator /=. More...
|
|
template<typename T > |
bool | operator== (const Vector2< T > &left, const Vector2< T > &right) |
| Overload of binary operator ==. More...
|
|
template<typename T > |
bool | operator!= (const Vector2< T > &left, const Vector2< T > &right) |
| Overload of binary operator !=. More...
|
|
template<typename T>
class gd::Vector2< T >
Utility template class for manipulating 2-dimensional vectors.
gd::Vector2 is a simple class that defines a mathematical vector with two coordinates (x and y). It can be used to represent anything that has two dimensions: a size, a point, a velocity, etc.
The template parameter T is the type of the coordinates. It can be any type that supports arithmetic operations (+, -, /, *) and comparisons (==, !=), for example int or float.
You generally don't have to care about the templated form (gd::Vector2<T>), the most common specializations have special typedefs:
- gd::Vector2<float> is gd::Vector2f
- gd::Vector2<int> is gd::Vector2i
- gd::Vector2<unsigned int> is gd::Vector2u
The gd::Vector2 class has a small and simple interface, its x and y members can be accessed directly (there are no accessors like setX(), getX()) and it contains no mathematical function like dot product, cross product, length, etc.
Usage example:
v1.x = 18.2f;
v3 = v1 + v2;
bool different = (v2 != v3);
Utility template class for manipulating 2-dimensional vectors.
Definition: Vector2.h:40
T y
Y coordinate of the vector.
Definition: Vector2.h:89
Note: for 3-dimensional vectors, see gd::Vector3.