summaryrefslogtreecommitdiff
path: root/inc/functions.hpp
blob: 7ce9f8d360df5d718dec4dec96eeae8afca8b743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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;
}

#endif