| 1 | #include "mathw.h" |
| 2 | |
| 3 | |
| 4 | /// ***** Private Varibles ***** |
| 5 | |
| 6 | const float PI = 3.141592653; |
| 7 | |
| 8 | |
| 9 | /// ***** Public Methods ***** |
| 10 | |
| 11 | int mod(int x, int y) |
| 12 | { |
| 13 | return x % y + (x < 0 ? y : 0); |
| 14 | } |
| 15 | |
| 16 | /// Vector2 Math |
| 17 | |
| 18 | Vector2 perp(const Vector2& vec) |
| 19 | { |
| 20 | return Vector2(-vec.y, vec.x); |
| 21 | } |
| 22 | |
| 23 | float dot(const Vector2& vec1, const Vector2& vec2) |
| 24 | { |
| 25 | return vec1.x * vec2.x + vec1.y * vec2.y; |
| 26 | } |
| 27 | |
| 28 | //TODO float Vector2::projectionCoeff(const Vector2* vec) const; |
| 29 | //TODO Vector2* Vector2::projection(const Vector2* vec) const; |
| 30 | |