float mapIt;
float myOtherMap;
float mappit(float c, float a, float b, float d, float e) {
return (((c-a)*(e-d)) / (b-a)) + d;
}
boolean testIt(float c, float a, float b) {
if(c >=a && c<= b) {
return true;
} else {
return false;
}
}
void compare() {
float b = random(2,200);
float a = random(2,b);
float c = random(a,b);
float e = random(2,200);
float d = random(2,e);
mapIt = map(c,a,b,d,e);
myOtherMap = mappit(c,a,b,d,e);
//println("res:" + testIt(c,a,b));
//println("d: " + d + " e: " + e);
println("map: " + mapIt + " myMap: " + myOtherMap);
}
void setup() {
size(200,200);
frameRate(5);
}
void draw() {
compare();
}