Working on a new generator class, nearly there
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user