// scale transform // ax + b // // // Author: Alexander Bogomolny, CTK Software, Inc. // URL: http://www.cut-the-knot.com // Date: November 30, 2000 // Copyright: A. Bogomolny // Permission to use and modify the file is therefore granted // as long as this comment remains unchanged. Do this at your // own risk. // class Scale { double a; double b; public Scale(double a, double b) { this.a = a; this.b = b; } public double Do(double x) { return a*x + b; } public double Reverse(double x) { return (x - b)/a; } public Scale Inverse() { return new Scale(1/a, -b/a); } }