Commit | Line | Data |
---|---|---|
ad9f1fb6 PG |
1 | #include "mathw.h" |
2 | ||
3 | ||
ad9f1fb6 PG |
4 | /// ***** Public Methods ***** |
5 | ||
6 | int mod(int x, int y) | |
7 | { | |
8 | return x % y + (x < 0 ? y : 0); | |
9 | } | |
10 | ||
617dcc71 | 11 | // Vector2 Math |
ad9f1fb6 PG |
12 | |
13 | Vector2 perp(const Vector2& vec) | |
14 | { | |
15 | return Vector2(-vec.y, vec.x); | |
16 | } | |
17 | ||
18 | float dot(const Vector2& vec1, const Vector2& vec2) | |
19 | { | |
20 | return vec1.x * vec2.x + vec1.y * vec2.y; | |
21 | } | |
22 | ||
23 | //TODO float Vector2::projectionCoeff(const Vector2* vec) const; | |
24 | //TODO Vector2* Vector2::projection(const Vector2* vec) const; | |
25 |