Working on a new generator class, nearly there

This commit is contained in:
Kayne Ruse
2014-06-18 01:00:31 +10:00
parent ff5c170579
commit fbaf15337f
13 changed files with 190 additions and 14 deletions
+9
View File
@@ -30,6 +30,15 @@ double snap(double x, double base) {
return floor(x / base) * base;
}
int snap(int x, int base) {
//snap to a grid (integer devision version)
if (x < 0) {
++x;
return x / base * base - base;
}
return x / base * base;
}
double scalarProduct(Vector2 lhs, Vector2 rhs) {
//the dot product
return lhs.x * rhs.x + lhs.y * rhs.y;