|
|
|
|
@ -91,6 +91,13 @@ struct Point {
|
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Point &operator*=(const float factor) |
|
|
|
|
{ |
|
|
|
|
x *= factor; |
|
|
|
|
y *= factor; |
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
friend Point operator+(Point a, const Point &b) |
|
|
|
|
{ |
|
|
|
|
a += b; |
|
|
|
|
@ -103,6 +110,20 @@ struct Point {
|
|
|
|
|
return a; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
friend Point operator-(const Point &a) |
|
|
|
|
{ |
|
|
|
|
Point b; |
|
|
|
|
b.x = -a.x; |
|
|
|
|
b.y = -a.y; |
|
|
|
|
return b; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
friend Point operator*(Point a, const float factor) |
|
|
|
|
{ |
|
|
|
|
a *= factor; |
|
|
|
|
return a; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Fast approximate distance between two points, using only integer arithmetic, with less than ~5% error |
|
|
|
|
* @param other Pointer to which we want the distance |
|
|
|
|
|