static double constrain(double amt, double low, double high) { return (amt < low) ? low : ((amt > high) ? high : amt); }