expectedDirection.normalize();
VectorTestHelper.assertVectorEquals(expectedDirection, actualDirection);
}
public void testGetWhiteFactor() {
assertEquals(new Percent(25), mockSun.getRiseAngle());
assertEquals(new Percent(50), mockSun.getZenithAngle());
assertEquals((float) Math.sqrt(2) / 2, sun3D.getWhiteFactor().getValue().floatValue());
mockSun.setZenithAngle(new Percent(0));
sun3D.update(mockSun, SunUpdateCode.zenithAngle);
mockSun.setRiseAngle(new Percent(0));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(25));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(50));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(75));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(100));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setZenithAngle(new Percent(50));
sun3D.update(mockSun, SunUpdateCode.zenithAngle);
mockSun.setRiseAngle(new Percent(0));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(25));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals((float) Math.sqrt(2) / 2, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(50));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals((float) Math.sqrt(Math.sqrt(2) / 2), sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(75));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals((float) Math.sqrt(2) / 2, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(100));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setZenithAngle(new Percent(100));
sun3D.update(mockSun, SunUpdateCode.zenithAngle);
mockSun.setRiseAngle(new Percent(0));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(25));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals((float) Math.sqrt(Math.sqrt(2) / 2), sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(50));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(1f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(75));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals((float) Math.sqrt(Math.sqrt(2) / 2), sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
mockSun.setRiseAngle(new Percent(100));
sun3D.update(mockSun, SunUpdateCode.riseAngle);
assertEquals(0f, sun3D.getWhiteFactor().getValue().floatValue(), 0.001f);
}