double rangeScale( double amin, double amax, double bmin, double bmax, double b) => amin + ((amax - amin) * ((b - bmin) / (bmax - bmin)));