static double inverseLerp(double min, double max, double value) { if (min == max) return min; return (value - min) / (max - min); }