rendered paste body--- Ray.java Sun Jul 15 23:10:49 2007+++ Ray_mod.java Sun Jul 15 23:10:56 2007@@ -32,7 +32,7 @@ Math.pow(this.normVector.getY(),2) + Math.pow(this.normVector.getZ(),2); - double B = 2 * (this.normVector.getX() * (this.origin.getX() - object.getCenter().getX()) + + double B = (this.normVector.getX() * (this.origin.getX() - object.getCenter().getX()) + this.normVector.getY() * (this.origin.getY() - object.getCenter().getY()) + this.normVector.getZ() * (this.origin.getZ() - object.getCenter().getZ())); @@ -42,15 +42,15 @@ Math.pow(object.getRadius(),2); // Get the discriminant.- double discriminant = Math.pow(B,2) - (4*A*C);+ double discriminant = Math.pow(B,2) - (A*C); // If the discriminant is negative, it is incalcuable (under a radical), so return null. if(discriminant < 0) { return null; } else { // Calculate both parts to the quadratic equation.- double minus = (-B - Math.sqrt(discriminant))/(2*A);- double plus = (-B + Math.sqrt(discriminant))/(2*A);+ double minus = (-B - Math.sqrt(discriminant))/(A);+ double plus = (-B + Math.sqrt(discriminant))/(A); double[] both = new double[2]; both[0] = minus; both[1] = plus;