MCPcopy Create free account
hub / github.com/microsoft/SandDance / getSolarPosition

Function getSolarPosition

docs/app/js/sanddance-app.js:95785–95795  ·  view source on GitHub ↗
(timestamp, latitude, longitude)

Source from the content-addressed store, hash-verified

95783var THETA0 = 280.147;
95784var THETA1 = 360.9856235;
95785function getSolarPosition(timestamp, latitude, longitude) {
95786 var longitudeWestInRadians = DEGREES_TO_RADIANS * -longitude;
95787 var phi = DEGREES_TO_RADIANS * latitude;
95788 var d = toDays(timestamp);
95789 var c = getSunCoords(d);
95790 var H = getSiderealTime(d, longitudeWestInRadians) - c.rightAscension;
95791 return {
95792 azimuth: getAzimuth(H, phi, c.declination),
95793 altitude: getAltitude(H, phi, c.declination)
95794 };
95795}
95796function getSunlightDirection(timestamp, latitude, longitude) {
95797 var _getSolarPosition = getSolarPosition(timestamp, latitude, longitude), azimuth = _getSolarPosition.azimuth, altitude = _getSolarPosition.altitude;
95798 var azimuthN = azimuth + Math.PI;

Callers 1

getSunlightDirectionFunction · 0.70

Calls 5

toDaysFunction · 0.70
getSunCoordsFunction · 0.70
getSiderealTimeFunction · 0.70
getAzimuthFunction · 0.70
getAltitudeFunction · 0.70

Tested by

no test coverage detected