@math.gl/sun
Advanced tools
Comparing version 3.6.0-alpha.6 to 3.6.0-alpha.7
@@ -35,4 +35,3 @@ "use strict"; | ||
var azimuthN = azimuth + Math.PI; | ||
return [-Math.sin(azimuthN), Math.cos(azimuthN), -Math.sin(altitude)]; | ||
return [Math.sin(azimuth) * Math.cos(altitude), Math.cos(azimuth) * Math.cos(altitude), -Math.sin(altitude)]; | ||
} | ||
@@ -39,0 +38,0 @@ |
@@ -26,4 +26,3 @@ const DEGREES_TO_RADIANS = Math.PI / 180; | ||
} = getSunPosition(timestamp, latitude, longitude); | ||
const azimuthN = azimuth + Math.PI; | ||
return [-Math.sin(azimuthN), Math.cos(azimuthN), -Math.sin(altitude)]; | ||
return [Math.sin(azimuth) * Math.cos(altitude), Math.cos(azimuth) * Math.cos(altitude), -Math.sin(altitude)]; | ||
} | ||
@@ -30,0 +29,0 @@ |
@@ -32,6 +32,8 @@ const DEGREES_TO_RADIANS = Math.PI / 180; | ||
const { azimuth, altitude } = getSunPosition(timestamp, latitude, longitude); | ||
// convert azimuth from 0 at south to be 0 at north | ||
const azimuthN = azimuth + Math.PI; | ||
// solar position to light direction | ||
return [-Math.sin(azimuthN), Math.cos(azimuthN), -Math.sin(altitude)]; | ||
return [ | ||
Math.sin(azimuth) * Math.cos(altitude), | ||
Math.cos(azimuth) * Math.cos(altitude), | ||
-Math.sin(altitude) | ||
]; | ||
} | ||
@@ -38,0 +40,0 @@ function toJulianDay(timestamp) { |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "3.6.0-alpha.6", | ||
"version": "3.6.0-alpha.7", | ||
"keywords": [ | ||
@@ -32,3 +32,3 @@ "javascript", | ||
}, | ||
"gitHead": "3b19564c634dc2c0255708b024425050c7fb2b9f" | ||
"gitHead": "166f7411d07d545e6a3f247b55b56f5cb8efccde" | ||
} |
@@ -59,7 +59,9 @@ const DEGREES_TO_RADIANS = Math.PI / 180; | ||
const {azimuth, altitude} = getSunPosition(timestamp, latitude, longitude); | ||
// convert azimuth from 0 at south to be 0 at north | ||
const azimuthN = azimuth + Math.PI; | ||
// solar position to light direction | ||
return [-Math.sin(azimuthN), Math.cos(azimuthN), -Math.sin(altitude)]; | ||
return [ | ||
Math.sin(azimuth) * Math.cos(altitude), | ||
Math.cos(azimuth) * Math.cos(altitude), | ||
-Math.sin(altitude) | ||
]; | ||
} | ||
@@ -66,0 +68,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
391
39834