Package jinngine.math

Examples of jinngine.math.Matrix4


    }

    @Test
    public void testInverse01() {
        Matrix4 m = Matrix4.scaleMatrix(2, 3, 4);
        Matrix4 r = m.inverse();
        assertNotSame(r, m);
        assertMatrixEquals(new double[]{
                    2.0, 0.0, 0.0, 0.0,
                    0.0, 3.0, 0.0, 0.0,
                    0.0, 0.0, 4.0, 0.0,
                    0.0, 0.0, 0.0, 1.0}, m);
        Matrix4 i = r.assignMultiply(m);
        assertMatrixEquals(new double[]{
                    1., 0., 0., 0.,
                    0., 1., 0., 0.,
                    0., 0., 1., 0.,
                    0., 0., 0., 1.}, i, 1E-15);
View Full Code Here


                    0., 0., 0., 1.}, i, 1E-15);
    }

    @Test
    public void testInverse02() {
        Matrix4 m = new Matrix4(
                1., 0., 0., 0.,
                0., 1., 0., 0.,
                0., 0., 1., 0.,
                0., 0., 0., 1.);
        Matrix4 r = m.inverse();
        assertMatrixEquals(new double[]{
                    1., 0., 0., 0.,
                    0., 1., 0., 0.,
                    0., 0., 1., 0.,
                    0., 0., 0., 1.}, r, 1E-15);
View Full Code Here

    }

    @Test
    public void testToArray() {

        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        final double[] d = m.toArray();
        final double[] d2 = m.toArray();
        assertNotSame(
                d, d2);
        assertMatrixEquals(
                new double[]{
                    1., 2., 3., 4.,
View Full Code Here

    @Test
    public void testToString() {
        assertEquals("[1.0, 2.0, 3.0, 4.0]\n"
                + "[5.0, 6.0, 7.0, 8.0]\n"
                + "[9.0, 10.0, 11.0, 12.0]\n"
                + "[13.0, 14.0, 15.0, 16.0]", new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).toString());
    }
View Full Code Here

  @Override
  public final double getMass() { return uniformmass; }

  @Override
  public final Matrix4 getTransform() {
    Matrix4 T =  Transforms.transformAndTranslate4(rotation, translation);
    return body.getTransform().multiply(T);
  }
View Full Code Here

    }

    @Test
    public void testCtorMatrix4() {
        final Matrix3 m = new Matrix3(new Matrix4(
                1., 2., 3., -1.,
                4., 5., 6., -1.,
                7., 8., 9., -1.,
                -1., -1., -1., -1.));
View Full Code Here

TOP

Related Classes of jinngine.math.Matrix4

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.