349f8999ac32c2df4c66ee116430783346bc4f4e
[physics.git] / src / mathw.cpp
1 #include "mathw.h"
2
3
4 /// ***** Public Methods *****
5
6 int mod(int x, int y)
7 {
8   return x % y + (x < 0 ? y : 0);
9 }
10
11 // Vector2 Math
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