Package javax.vecmath

Examples of javax.vecmath.Vector3f.normalize()


        mockSun.setRiseAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(-1, 0, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);
    }

    /**
     * Test rise angle with zenith angle set to 0
View Full Code Here


        // Pi/4
        assertEquals(PercentHelper.getDecimalValue(25), mockSun.getRiseAngle());
        Vector3f actualDirection = new Vector3f();
        sunLight.getDirection(actualDirection);
        Vector3f expectedDirection = new Vector3f((float) Math.sqrt(2) / 2, 0f, (float) -Math.sqrt(2) / 2);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // 0 Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // 0 Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(1, 0, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // Pi/2
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(50));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // Pi/2
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(50));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(0, 0, -1);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // 3Pi/4
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(75));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // 3Pi/4
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(75));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(-(float) Math.sqrt(2) / 2, 0, -(float) Math.sqrt(2) / 2);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(-1, 0, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);
    }

    /**
     * Test rise angle with zenith angle set to 100% (Pi/2)
View Full Code Here

        // Pi/4
        assertEquals(PercentHelper.getDecimalValue(25), mockSun.getRiseAngle());
        Vector3f actualDirection = new Vector3f();
        sunLight.getDirection(actualDirection);
        Vector3f expectedDirection = new Vector3f((float) Math.sqrt(2) / 2, -(float) Math.sqrt(2) / 2, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // 0 Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // 0 Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(0));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(1, 0, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // Pi/2
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(50));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // Pi/2
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(50));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(0, -1, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // 3Pi/4
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(75));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

        // 3Pi/4
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(75));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
        sunLight.getDirection(actualDirection);
        expectedDirection = new Vector3f(-(float) Math.sqrt(2) / 2, -(float) Math.sqrt(2) / 2, 0);
        expectedDirection.normalize();
        VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);

        // Pi
        mockSun.setRiseAngle(PercentHelper.getDecimalValue(100));
        sun3D.update(mockSun, SunUpdateCode.riseAngle);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.