// 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/util/SingularMatrixException.java
// public class SingularMatrixException extends RuntimeException
// {
//     private static final long serialVersionUID = -4744745375693073952L;
// 
//     /**
//      * Creates a new exception.
//      */
//     public SingularMatrixException () {
//     }
// 
//     /**
//      * Creates a new exception with the provided message.
//      */
//     public SingularMatrixException (String message) {
//         super(message);
//     }
// }


import pythagoras.util.Platform;
import pythagoras.util.SingularMatrixException;
import java.io.Serializable;
import java.nio.DoubleBuffer;

    @Override // from IMatrix3
    public Matrix3 multAffine (IMatrix3 other, Matrix3 result) {
        double m00 = this.m00, m01 = this.m01;
        double m10 = this.m10, m11 = this.m11;
        double m20 = this.m20, m21 = this.m21;
        double om00 = other.m00(), om01 = other.m01();
        double om10 = other.m10(), om11 = other.m11();
        double om20 = other.m20(), om21 = other.m21();
        return result.set(m00*om00 + m10*om01,
                          m00*om10 + m10*om11,
                          m00*om20 + m10*om21 + m20,

                          m01*om00 + m11*om01,
                          m01*om10 + m11*om11,
                          m01*om20 + m11*om21 + m21,

                          0f, 0f, 1f);
    }

    @Override // from IMatrix3
    public Matrix3 invert () {
        return invert(new Matrix3());
    }

    /**
     * {@inheritDoc} This code is based on the examples in the
     * <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
     */
    @Override // from IMatrix3
// 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/util/SingularMatrixException.java
// public class SingularMatrixException extends RuntimeException
// {
//     private static final long serialVersionUID = -4744745375693073952L;
// 
//     /**
//      * Creates a new exception.
//      */
//     public SingularMatrixException () {
//     }
// 
//     /**
//      * Creates a new exception with the provided message.
//      */
//     public SingularMatrixException (String message) {
//         super(message);
//     }
// }


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


    @Override // from IMatrix3
    public Matrix3 multAffine (IMatrix3 other, Matrix3 result) {
        double m00 = this.m00, m01 = this.m01;
        double m10 = this.m10, m11 = this.m11;
        double m20 = this.m20, m21 = this.m21;
        double om00 = other.m00(), om01 = other.m01();
        double om10 = other.m10(), om11 = other.m11();
        double om20 = other.m20(), om21 = other.m21();
        return result.set(m00*om00 + m10*om01,
                          m00*om10 + m10*om11,
                          m00*om20 + m10*om21 + m20,

                          m01*om00 + m11*om01,
                          m01*om10 + m11*om11,
                          m01*om20 + m11*om21 + m21,

                          0f, 0f, 1f);
    }

    @Override // from IMatrix3
    public Matrix3 invert () {
        return invert(new Matrix3());
    }

    /**
     * {@inheritDoc} This code is based on the examples in the
     * <a href="http://www.j3d.org/matrix_faq/matrfaq_latest.html">Matrix and Quaternion FAQ</a>.
     */
    @Override // from IMatrix3
    public Matrix3 invert (Matrix3 result) throws SingularMatrixException {