// 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.util.Random;

    @Override // from IQuaternion
    public float getRotationZ () {
        return FloatMath.atan2(2f*(x*y + z*w), 1f - 2f*(y*y + z*z));
    }

    @Override // from IQuaternion
    public Quaternion integrate (IVector3 velocity, float t) {
        return integrate(velocity, t, new Quaternion());
    }

    @Override // from IQuaternion
    public Quaternion integrate (IVector3 velocity, float t, Quaternion result) {
        // TODO: use Runge-Kutta integration?
        float qx = 0.5f * velocity.x();
        float qy = 0.5f * velocity.y();
        float qz = 0.5f * velocity.z();
        return result.set(x + t*(qx*w + qy*z - qz*y),
                          y + t*(qy*w + qz*x - qx*z),
                          z + t*(qz*w + qx*y - qy*x),
                          w + t*(-qx*x - qy*y - qz*z)).normalizeLocal();
    }

    @Override // documentation inherited
    public String toString () {
        return "[" + x + ", " + y + ", " + z + ", " + w + "]";
    }

    @Override // documentation inherited
    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/f/Quaternion.java
import pythagoras.util.Platform;
import java.io.Serializable;
import java.util.Random;


    @Override // from IQuaternion
    public float getRotationZ () {
        return FloatMath.atan2(2f*(x*y + z*w), 1f - 2f*(y*y + z*z));
    }

    @Override // from IQuaternion
    public Quaternion integrate (IVector3 velocity, float t) {
        return integrate(velocity, t, new Quaternion());
    }

    @Override // from IQuaternion
    public Quaternion integrate (IVector3 velocity, float t, Quaternion result) {
        // TODO: use Runge-Kutta integration?
        float qx = 0.5f * velocity.x();
        float qy = 0.5f * velocity.y();
        float qz = 0.5f * velocity.z();
        return result.set(x + t*(qx*w + qy*z - qz*y),
                          y + t*(qy*w + qz*x - qx*z),
                          z + t*(qz*w + qx*y - qy*x),
                          w + t*(-qx*x - qy*y - qz*z)).normalizeLocal();
    }

    @Override // documentation inherited
    public String toString () {
        return "[" + x + ", " + y + ", " + z + ", " + w + "]";
    }

    @Override // documentation inherited
    public int hashCode () {
        return Platform.hashCode(x) ^ Platform.hashCode(y) ^ Platform.hashCode(z) ^