Open wtitec opened 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 }
// 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.
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.