Skip to content

Commit 65f3dfe

Browse files
committed
Bug fix for https://bugs.launchpad.net/or/+bug/1992301 World becoming fully dark
1 parent fff05e6 commit 65f3dfe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Source/RunActivity/Viewer3D/Common/SunMoonPos.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public static Vector3 SolarAngle(double latitude, double longitude, float clockT
8686
+Math.Cos(latitude)
8787
* Math.Sin(Math.Acos(solarZenithCosine)));
8888

89+
// Running at 64 bit solarAzimuthCosine can be slightly below -1, generating NaN results
90+
if (solarAzimuthCosine > 1.0d) solarAzimuthCosine = 1.0d;
91+
if (solarAzimuthCosine < -1.0d) solarAzimuthCosine = -1.0d;
92+
8993
// Solar azimuth angle, radians. Currently not used.
9094
// double solarAzimuthAngle = Math.Acos(solarAzimuthCosine);
9195
// if (clockTime > 0.5)

0 commit comments

Comments
 (0)