Rescales a value from one domain/range to another.
double rescale(double t, double oMin, double oMax, double nMin, double nMax) { return nMin + (nMax - nMin) * normalize(t, oMin, oMax); }