Package jinngine.math

Examples of jinngine.math.Matrix4


                    13, 14, 15, 16}, m);
    }

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


                    13, 14, 15, 16}, m);
    }

    @Test
    public void testAssignMatrix() {
        final Matrix4 m = new Matrix4();
        final Matrix4 r = m.assign(new Matrix4(
                1., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16));
        assertSame(r, m);//assert it return this
View Full Code Here

    }

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

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

    @Test
    public void testAssignIdentity() {
        final Matrix4 m = new Matrix4(
                2., 2., 3., 4.,
                5., 6., 7., 8.,
                9., 10, 11, 12,
                13, 14, 15, 16);
        final Matrix4 r = m.assignIdentity();
        assertSame(r, m);//assert it return this
        assertMatrixEquals(new double[]{
                    1., 0., 0., 0.,
                    0., 1., 0., 0.,
                    0., 0., 1., 0.,
View Full Code Here

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

    @Test
    public void testFtorScaleDouble() {
        final Matrix4 m = Matrix4.scaleMatrix(3.);
        final Matrix4 n = Matrix4.scaleMatrix(3.);
        assertNotSame(n, m);//create a new referene everytime like a ctor
        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 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

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.