Package jinngine.math

Examples of jinngine.math.Matrix4


                    0., 0., 0., 1.}, m);
    }

    @Test
    public void testAssignScaleDouble() {
        final Matrix4 m = new Matrix4(
                1., 0., 0., 0.,
                0., 1., 0., 0.,
                0., 0., 1., 0.,
                0., 0., 0., 1.);
        final Matrix4 r = m.assignScale(3.);
        assertSame(r, m);//assert it return this
        assertMatrixEquals(new double[]{
                    3., 0., 0., 0.,
                    0., 3., 0., 0.,
                    0., 0., 3., 0.,
View Full Code Here


                    0., 0., 0., 1.}, m);
    }

    @Test
    public void testFtorScale3Double() {
        final Matrix4 m = Matrix4.scaleMatrix(2., 3., 4.);
        final Matrix4 n = Matrix4.scaleMatrix(2., 3., 4.);
        assertNotSame(n, m);//create a new referene everytime like a ctor
        assertMatrixEquals(new double[]{
                    2., 0., 0., 0.,
                    0., 3., 0., 0.,
                    0., 0., 4., 0.,
View Full Code Here

                    0., 0., 0., 1.}, m);
    }

    @Test
    public void testAssign3Double() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);

        final Matrix4 r = m.assignScale(2., 3., 4.);
        assertSame(r, m);//assert it return this
        assertMatrixEquals(new double[]{
                    2., 0., 0., 0.,
                    0., 3., 0., 0.,
                    0., 0., 4., 0.,
View Full Code Here

                    0., 0., 0., 1.}, m);
    }

    @Test
    public void testMultiply01() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        final Matrix4 n = new Matrix4(
                10., 20., 30., 40.,
                50., 60., 70., 80.,
                90., 100, 110, 120,
                130, 140, 150, 160);
        final Matrix4 r = m.multiply(n);
        assertNotSame(m, r); // R is new
        assertNotSame(n, r); // R is new

        //Input is not changed
        assertMatrixEquals(new double[]{
View Full Code Here

                    4260.0, 4840.0, 5420.0, 6000.0}, r);
    }

    @Test(expected = NullPointerException.class)
    public void testMultiply02() {
        new Matrix4().multiply((Matrix4) null);
    }
View Full Code Here

        new Matrix4().multiply((Matrix4) null);
    }

    @Test
    public void testAssignMultiply01() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        final Matrix4 n = new Matrix4(
                10., 20., 30., 40.,
                50., 60., 70., 80.,
                90., 100, 110, 120,
                130, 140, 150, 160);
        final Matrix4 r = m.assignMultiply(n);
        assertSame(m, r); // r is m
        assertNotSame(n, r); // R is new       
        //Input is not changed
        assertMatrixEquals(new double[]{
                    10., 20., 30., 40.,
View Full Code Here

                    4260.0, 4840.0, 5420.0, 6000.0,}, r);
    }

    @Test(expected = NullPointerException.class)
    public void testAssignMultiply02() {
        new Matrix4().assignMultiply((Matrix4) null);
    }
View Full Code Here

        new Matrix4().assignMultiply((Matrix4) null);
    }

    @Test
    public void testMultiplyVector01() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        final Vector3 v = new Vector3(100., 10000., 1000000.);
        final Vector3 r = m.multiply(v);
        assertNotSame(r, v);//new Vector3 is returned
        //Input is not changed
        assertMatrixEquals(new double[]{
                    1., 2., 3., 4.,
                    5., 6., 7., 8.,
View Full Code Here

    }

    @Test(expected = NullPointerException.class)
    public void testAssignMultiplyVector02() {
        new Matrix4().multiply((Vector3) null);
    }
View Full Code Here

        new Matrix4().multiply((Vector3) null);
    }

    @Test
    public void testIsNan() {
        final Matrix4 m = new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        assertFalse(m.isNaN());
        assertMatrixEquals(new double[]{
                    1., 2., 3., 4.,
                    5., 6., 7., 8.,
                    9., 10, 11, 12,
                    13, 14, 15, 16}, m);

        assertTrue(new Matrix4(
                1., Double.NaN, 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., Double.NaN, 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., Double.NaN,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                Double.NaN, 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., Double.NaN, 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., Double.NaN, 8.,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., Double.NaN,
                9., 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                Double.NaN, 10, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., Double.NaN, 11, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, Double.NaN, 12,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, Double.NaN,
                13, 14, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                Double.NaN, 14, 15, 16).isNaN());

        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, Double.NaN, 15, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, Double.NaN, 16).isNaN());
        assertTrue(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, Double.NaN).isNaN());
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.