joshuaferrara / go-satellite

Calculate orbital information of satellites in GoLang.
BSD 2-Clause "Simplified" License
78 stars 27 forks source link

LLAToECI #24

Open wtitec opened 3 months ago

wtitec commented 3 months ago

https://github.com/joshuaferrara/go-satellite/blob/master/conversions.go

There is a possible error in the LLAToECI function.

The correct calculation would be:

// Convert latitude, longitude and altitude(km) into equivalent Earth Centered Intertial coordinates(km) // Reference: The 1992 Astronomical Almanac, page K11. func LLAToECI(obsCoords LatLong, alt, jday float64) (eciObs Vector3) { re := 6378.137 theta := math.Mod(ThetaG_JD(jday)+obsCoords.Longitude, TWOPI) r := re * math.Cos(obsCoords.Latitude) eciObs.X = r * math.Cos(theta) eciObs.Y = r * math.Sin(theta) eciObs.Z = (re + alt) * math.Sin(obsCoords.Latitude) return }

I hope I've helped.