blob: b0ecb65ba5fdf798db3e5263150a953cf2a8562f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#ifndef functions_h
#define functions_h
#include <cmath>
#include "rectangle.hpp"
static double Distance(Rectangle A, Rectangle B){
return sqrt(pow(A.x-B.x,2) + pow(A.y-B.y,2));
}
static int map(int x, int inMin, int inMax, int outMin, int outMax){
return (x-inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
static float getRandom(float x){
return (-x + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(x-(-x)))));
}
#endif
|