// Path: src/gwt/java/pythagoras/util/Platform.java
// public class Platform
// {
//     /**
//      * Returns a hash code for the supplied float value.
//      */
//     public static int hashCode (float f1) {
//         return (int)f1; // alas nothing better can be done in JavaScript
//     }
// 
//     /**
//      * Returns a hash code for the supplied double value.
//      */
//     public static int hashCode (double d1) {
//         return (int)d1; // alas nothing better can be done in JavaScript
//     }
// 
//     /**
//      * Clones the supplied array of bytes.
//      */
//     public static native byte[] clone (byte[] values) /*-{
//         return values.slice(0);
//     }-*/;
// 
//     /**
//      * Clones the supplied array of ints.
//      */
//     public static native int[] clone (int[] values) /*-{
//         return values.slice(0);
//     }-*/;
// 
//     /**
//      * Clones the supplied array of floats.
//      */
//     public static native float[] clone (float[] values) /*-{
//         return values.slice(0);
//     }-*/;
// 
//     /**
//      * Clones the supplied array of doubles.
//      */
//     public static native double[] clone (double[] values) /*-{
//         return values.slice(0);
//     }-*/;
// }


import pythagoras.util.Platform;
import java.io.Serializable;
import java.nio.DoubleBuffer;
        result.constant = -constant;
        return result;
    }

    @Override // from IPlane
    public boolean intersection (IRay3 ray, Vector3 result) {
        double distance = distance(ray);
        if (Double.isNaN(distance) || distance < 0f) {
            return false;
        } else {
            ray.origin().addScaled(ray.direction(), distance, result);
            return true;
        }
    }

    @Override // from IPlane
    public double distance (IRay3 ray) {
        double dividend = -distance(ray.origin());
        double divisor = _normal.dot(ray.direction());
        if (Math.abs(dividend) < MathUtil.EPSILON) {
            return 0f; // origin is on plane
        } else if (Math.abs(divisor) < MathUtil.EPSILON) {
            return Float.NaN; // ray is parallel to plane
        } else {
            return dividend / divisor;
        }
    }

    @Override
    public int hashCode () {
// Path: src/gwt/java/pythagoras/util/Platform.java
// public class Platform
// {
//     /**
//      * Returns a hash code for the supplied float value.
//      */
//     public static int hashCode (float f1) {
//         return (int)f1; // alas nothing better can be done in JavaScript
//     }
// 
//     /**
//      * Returns a hash code for the supplied double value.
//      */
//     public static int hashCode (double d1) {
//         return (int)d1; // alas nothing better can be done in JavaScript
//     }
// 
//     /**
//      * Clones the supplied array of bytes.
//      */
//     public static native byte[] clone (byte[] values) /*-{
//         return values.slice(0);
//     }-*/;
// 
//     /**
//      * Clones the supplied array of ints.
//      */
//     public static native int[] clone (int[] values) /*-{
//         return values.slice(0);
//     }-*/;
// 
//     /**
//      * Clones the supplied array of floats.
//      */
//     public static native float[] clone (float[] values) /*-{
//         return values.slice(0);
//     }-*/;
// 
//     /**
//      * Clones the supplied array of doubles.
//      */
//     public static native double[] clone (double[] values) /*-{
//         return values.slice(0);
//     }-*/;
// }


// Path: src/main/java/pythagoras/d/Plane.java
import pythagoras.util.Platform;
import java.io.Serializable;
import java.nio.DoubleBuffer;

        result.constant = -constant;
        return result;
    }

    @Override // from IPlane
    public boolean intersection (IRay3 ray, Vector3 result) {
        double distance = distance(ray);
        if (Double.isNaN(distance) || distance < 0f) {
            return false;
        } else {
            ray.origin().addScaled(ray.direction(), distance, result);
            return true;
        }
    }

    @Override // from IPlane
    public double distance (IRay3 ray) {
        double dividend = -distance(ray.origin());
        double divisor = _normal.dot(ray.direction());
        if (Math.abs(dividend) < MathUtil.EPSILON) {
            return 0f; // origin is on plane
        } else if (Math.abs(divisor) < MathUtil.EPSILON) {
            return Float.NaN; // ray is parallel to plane
        } else {
            return dividend / divisor;
        }
    }

    @Override
    public int hashCode () {
        return _normal.hashCode() ^ Platform.hashCode(constant);