16 Vec2() : x(0.0f), y(0.0f) {}
23 Vec2(
float x,
float y) : x(x), y(y) {}
30 Vec2(
int x,
int y) : x((float)x), y((float)y) {}
62 return float(sqrt((x*x) + (y*y)));
88 vecOut.
x = vecInA.
x - vecInB.
x;
89 vecOut.
y = vecInA.
y - vecInB.
y;
102 vecOut.
x = vecInA.
x + vecInB.
x;
103 vecOut.
y = vecInA.
y + vecInB.
y;
116 vecOut.
x = vecInA.
x / scalar;
117 vecOut.
y = vecInA.
y / scalar;
130 vecOut.
x = vecInA.
x * scalar;
131 vecOut.
y = vecInA.
y * scalar;
144 vecOut.
x = vecInA.
x * vecInB.
x;
145 vecOut.
y = vecInA.
y * vecInB.
y;
float x
Position variables.
Definition: Vec2.h:11
Vec2 operator+(Vec2 vecInA, Vec2 vecInB)
Overloads the + operator.
Definition: Vec2.h:99
Vec2()
Constructs the Vec2 setting the values to 0,0.
Definition: Vec2.h:16
Contains the Vec2 structure with functions and overloaded operators.
Definition: Vec2.h:8
Vec2(float x, float y)
Constructs the Vec2 setting the values to the input coordinates.
Definition: Vec2.h:23
Vec2 operator*(Vec2 vecInA, float scalar)
Overloads the * operator allowing a Vec2 to be multiplied by a scalar.
Definition: Vec2.h:127
Vec2 operator-(Vec2 vecIn)
Overloads the - operator allowing a Vec2 to be inverted.
Definition: Vec2.h:71
Vec2(int x, int y)
Constructs the Vec2 setting the values to the input coordinates.
Definition: Vec2.h:30
float y
Definition: Vec2.h:11
Vec2 operator/(Vec2 vecInA, float scalar)
Overloads the / operator allowing a Vec2 to be divided by a scalar.
Definition: Vec2.h:113
Vec2 * operator+=(Vec2 vecIn)
Overloads the += operator.
Definition: Vec2.h:37
float getLength()
Returns the length of the Vec2.
Definition: Vec2.h:60
Vec2 * operator-=(Vec2 vecIn)
Overloads the -= operator.
Definition: Vec2.h:49