Package jinngine.math

Examples of jinngine.math.Matrix3


                    7., 8., 9.}, m);
    }

    @Test
    public void testAssignMatrix() {
        final Matrix3 m = new Matrix3();
        final Matrix3 r = m.assign(new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.));
        assertSame(r, m);//assert it return this
        //assert every value is 0.
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

                    7., 8., 9.}, m);
    }

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

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

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

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

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

                    0., 0., 3.}, m);
    }

    @Test
    public void testAssignScaleDouble() {
        final Matrix3 m = new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.);
        final Matrix3 r = m.assignScale(3.);
        assertSame(r, m);//assert it return this
        assertMatrixEquals(new double[]{
                    3., 0., 0.,
                    0., 3., 0.,
                    0., 0., 3.}, m);
View Full Code Here

                    0., 0., 3.}, m);
    }

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

                    0., 0., 4.}, m);
    }

    @Test
    public void testAssign3Double() {
        final Matrix3 m = new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.);
        final Matrix3 r = m.assignScale(2., 3., 4.);
        assertSame(r, m);//assert it return this
        assertMatrixEquals(new double[]{
                    2., 0., 0.,
                    0., 3., 0.,
                    0., 0., 4.}, m);
View Full Code Here

                    0., 0., 4.}, m);
    }

    @Test
    public void testColumn01() {
        final Matrix3 m = new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.);
        final Vector3 c1 = m.column(0);
        assertEquals(1., c1.x);
        assertEquals(4., c1.y);
        assertEquals(7., c1.z);
        final Vector3 c2 = m.column(1);
        assertNotSame(c1, c2); // Vector is not recycled
        assertEquals(2., c2.x);
        assertEquals(5., c2.y);
        assertEquals(8., c2.z);
        final Vector3 c3 = m.column(2);
        assertEquals(3., c3.x);
        assertEquals(6., c3.y);
        assertEquals(9., c3.z);
    }
View Full Code Here

        assertEquals(9., c3.z);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testColumn02() {
        new Matrix3().column(-1);
    }
View Full Code Here

TOP

Related Classes of jinngine.math.Matrix3

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.