src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

center.go (546B)


      1 package sunrise
      2 
      3 import (
      4 	"math"
      5 )
      6 
      7 // EquationOfCenter calculates the angular difference between the position of
      8 // the earth in its elliptical orbit and the position it would occupy in a
      9 // circular orbit for the given mean anomaly.
     10 func EquationOfCenter(solarAnomaly float64) float64 {
     11 	var (
     12 		anomalyInRad = solarAnomaly * (math.Pi / 180)
     13 		anomalySin   = math.Sin(anomalyInRad)
     14 		anomaly2Sin  = math.Sin(2 * anomalyInRad)
     15 		anomaly3Sin  = math.Sin(3 * anomalyInRad)
     16 	)
     17 	return 1.9148*anomalySin + 0.0200*anomaly2Sin + 0.0003*anomaly3Sin
     18 }