48 IntPoint(
int aX = 0,
int aY = 0) : x(aX), y(aY) {}
50 inline bool operator==(
const IntPoint& p)
const 52 return x == p.
x && y == p.
y;
55 inline bool operator!=(
const IntPoint& p)
const 57 return !operator==(p);
60 inline float Length()
const 62 return sqrtf(x*x + y*y);
74 return reinterpret_cast<int*
>(
this);
80 return reinterpret_cast<const int*
>(
this);
128 return IntPoint(left * right.
x, left * right.
y);
134 return IntPoint(left.
x * right, left.
y * right);
148 return IntPoint(left.
x / right, left.
y / right);
155 s <<
"[" << x <<
", " << y <<
"]";
const IntPoint & operator*=(const float &right)
Multiplies by given scalar.
Definition: intpoint.h:118
const int * Array() const
Returns the struct cast to const int* array; use with care!
Definition: intpoint.h:78
friend const IntPoint operator+(const IntPoint &left, const IntPoint &right)
Adds two points.
Definition: intpoint.h:98
int * Array()
Returns the struct cast to int* array; use with care!
Definition: intpoint.h:72
int y
Y coord.
Definition: intpoint.h:46
friend const IntPoint operator/(const IntPoint &left, const int &right)
Divides point by scalar.
Definition: intpoint.h:146
const IntPoint & operator/=(const float &right)
Divides by given scalar.
Definition: intpoint.h:138
const IntPoint & operator+=(const IntPoint &right)
Adds the given point.
Definition: intpoint.h:90
std::string ToString() const
Returns a string "[x, y]".
Definition: intpoint.h:152
void LoadZero()
Sets the zero point: (0,0)
Definition: intpoint.h:66
IntPoint operator-() const
Returns the inverted point.
Definition: intpoint.h:84
Namespace for (new) math code.
Definition: device.h:39
friend const IntPoint operator*(const IntPoint &left, const int &right)
Multiplies point by scalar.
Definition: intpoint.h:132
int x
X coord.
Definition: intpoint.h:44
2D Point with integer coords
Definition: intpoint.h:41
friend const IntPoint operator*(const float &left, const IntPoint &right)
Multiplies point by scalar.
Definition: intpoint.h:126
const IntPoint & operator-=(const IntPoint &right)
Subtracts the given point.
Definition: intpoint.h:104
friend const IntPoint operator-(const IntPoint &left, const IntPoint &right)
Subtracts two points.
Definition: intpoint.h:112