// AstrometricJ2000 is a utility function for computing astrometric coordinates. // // It is used internally and only exported so that it can be used from // multiple packages. It is not otherwise expected to be used. // // Argument f is a function that returns J2000 equatorial rectangular // coodinates of a body. // // Results are J2000 right ascention, declination, and elongation. func AstrometricJ2000(f func(float64) (x, y, z float64), jde float64, e *pp.V87Planet) (α, δ, ψ float64) { X, Y, Z := solarxyz.PositionJ2000(e, jde) x, y, z := f(jde) // (33.10) p. 229 ξ := X + x η := Y + y ζ := Z + z Δ := math.Sqrt(ξ*ξ + η*η + ζ*ζ) { τ := base.LightTime(Δ) x, y, z = f(jde - τ) ξ = X + x η = Y + y ζ = Z + z Δ = math.Sqrt(ξ*ξ + η*η + ζ*ζ) } α = math.Atan2(η, ξ) if α < 0 { α += 2 * math.Pi } δ = math.Asin(ζ / Δ) R0 := math.Sqrt(X*X + Y*Y + Z*Z) ψ = math.Acos((ξ*X + η*Y + ζ*Z) / R0 / Δ) return }
func ExamplePositionJ2000() { // Example 26.b, p. 175 but for output see complete VSOP87 // results given on p. 176. e, err := pp.LoadPlanet(pp.Earth) if err != nil { fmt.Println(err) return } x, y, z := solarxyz.PositionJ2000(e, 2448908.5) fmt.Printf("X0 = %.8f\n", x) fmt.Printf("Y0 = %.8f\n", y) fmt.Printf("Z0 = %.8f\n", z) // Output: // X0 = -0.93739707 // Y0 = -0.31316724 // Z0 = -0.13577841 }
// AstrometricJ2000 is a utility function for computing astrometric coordinates. // // It is used internally and only exported so that it can be used from // multiple packages. It is not otherwise expected to be used. // // Argument f is a function that returns J2000 equatorial rectangular // coodinates of a body. // // Results are J2000 right ascention, declination, and elongation. func AstrometricJ2000(f func(float64) (x, y, z float64), jde float64, e *pp.V87Planet) (α unit.RA, δ, ψ unit.Angle) { X, Y, Z := solarxyz.PositionJ2000(e, jde) x, y, z := f(jde) // (33.10) p. 229 ξ := X + x η := Y + y ζ := Z + z Δ := math.Sqrt(ξ*ξ + η*η + ζ*ζ) { τ := base.LightTime(Δ) x, y, z = f(jde - τ) ξ = X + x η = Y + y ζ = Z + z Δ = math.Sqrt(ξ*ξ + η*η + ζ*ζ) } α = unit.RAFromRad(math.Atan2(η, ξ)) δ = unit.Angle(math.Asin(ζ / Δ)) R0 := math.Sqrt(X*X + Y*Y + Z*Z) ψ = unit.Angle(math.Acos((ξ*X + η*Y + ζ*Z) / R0 / Δ)) return }