Commit: 26bcf55822737f24df800d73055d3ad4865e114b Parent: 0198e415862c729649fc7e7acca860406cdbc629 Author: Vi Grey Date: 2023-10-26 01:00 UTC Summary: More accurate disc angle calculation src/syzygy.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/syzygy.go b/src/syzygy.go index dfb6800..678f0f0 100644 --- a/src/syzygy.go +++ b/src/syzygy.go @@ -519,19 +519,25 @@ type xy struct { // Get atmostpheric refraction of object at alt func getAtmosphericRefraction(alt float64) float64 { - r := 1.02 / math.Tan((alt+(10.3/(alt+5.11)))/360*2*math.Pi) + r := 1.02 / math.Tan(degreesToRadians(alt+(10.3/(alt+5.11)))) return r * ((1013.25 / 1010) * (283 / 288.0)) / 60 } // Get apparent altitude due to refraction of object in the sky // based on its distance, radius, and actual angle in the sky func getApparentAltitude(dist, radius, angle float64) float64 { - discAngle := math.Atan(radius/dist) / (2 * math.Pi) * 360 + discAngle := getDiscAngle(dist, radius) alt := angle - 90 + discAngle refraction := getAtmosphericRefraction(alt) return alt + refraction } +// Get object disc angle in degrees for object dist distance away with +// given radius. Angle is in +func getDiscAngle(dist, radius float64) float64 { + return radiansToDegrees(math.Asin(radius / dist)) +} + // (47.1) Astronomical Algorithms, 2nd Edition p 338 // Moon Mean Longitude // t is time measured in Julian centuries from the