public class Point extends Complex{ public Point() { x = 0.0; y = 0.0; } public Point(double xVal, double yVal) { x = xVal; y = yVal; if (x == 1.0/0.0 || x == -1.0/0.0 || x == Double.NaN || y == 1.0/0.0 || y == -1.0/0.0 || y == Double.NaN) { System.out.println(" Point undefined: "+this); Point Q = null; Q.x = 3.0; } } public String toString() { return "("+x+","+y+")"; } /* Reflect the point A through this point B to get the returned point C. * The rule for computing A thru B (as complex numbers) is: | * * B - t A where t = (1+BB')/2, and * A |> B = ----------- B' is the complex * t - A B' conjugate of B */ public Point reflect (Point A) { double t = (1.0 + this.normSquared()) / 2.0; // compute the numerator as B - t * A Complex numerator = this.minus(A.times(t)); // compute the denominator as t - A * B' Complex denominator = Complex.subtract(t, A.times(this.conjugate())) ; Complex C = numerator.over(denominator) ; return new Point(C.x,C.y); } } // Point