Esempio n. 1
0
// Position returns ecliptic position of planets at equinox and ecliptic of date.
//
// Argument jde is the date for which positions are desired.
//
// Results are positions consistent with those from Meeus's Apendix III,
// that is, at equinox and ecliptic of date.
//
//  L is heliocentric longitude in radians.
//  B is heliocentric latitude in radians.
//  R is heliocentric range in AU.
func (vt *V87Planet) Position(jde float64) (L, B, R float64) {
	L, B, R = vt.Position2000(jde)
	eclFrom := &coord.Ecliptic{
		Lat: B,
		Lon: L,
	}
	eclTo := &coord.Ecliptic{}
	epochFrom := 2000.0
	epochTo := base.JDEToJulianYear(jde)
	precess.EclipticPosition(eclFrom, eclTo, epochFrom, epochTo, 0, 0)
	return eclTo.Lon, eclTo.Lat, R
}
Esempio n. 2
0
func ExampleEclipticPosition() {
	// Example 21.c, p. 137.
	eclFrom := &coord.Ecliptic{
		Lat: 1.76549 * math.Pi / 180,
		Lon: 149.48194 * math.Pi / 180,
	}
	eclTo := &coord.Ecliptic{}
	epochFrom := 2000.0
	epochTo := base.JDEToJulianYear(julian.CalendarJulianToJD(-214, 6, 30))
	precess.EclipticPosition(eclFrom, eclTo, epochFrom, epochTo, 0, 0)
	fmt.Printf("%.3f\n", eclTo.Lon*180/math.Pi)
	fmt.Printf("%+.3f\n", eclTo.Lat*180/math.Pi)
	// Output:
	// 118.704
	// +1.615
}
Esempio n. 3
0
func ExampleEclipticPosition() {
	// Example 21.c, p. 137.
	eclFrom := &coord.Ecliptic{
		Lat: unit.AngleFromDeg(1.76549),
		Lon: unit.AngleFromDeg(149.48194),
	}
	eclTo := &coord.Ecliptic{}
	epochFrom := 2000.0
	epochTo := base.JDEToJulianYear(julian.CalendarJulianToJD(-214, 6, 30))
	precess.EclipticPosition(eclFrom, eclTo, epochFrom, epochTo, 0, 0)
	fmt.Printf("%.3f\n", eclTo.Lon.Deg())
	fmt.Printf("%+.3f\n", eclTo.Lat.Deg())
	// Output:
	// 118.704
	// +1.615
}
Esempio n. 4
0
// Positions returns positions of the eight major moons of Saturn.
//
// Results returned in argument pos, which must not be nil.
//
// Result units are Saturn radii.
func Positions(jde float64, earth, saturn *pp.V87Planet, pos *[8]XY) {
	s, β, R := solar.TrueVSOP87(earth, jde)
	ss, cs := s.Sincos()
	sβ := β.Sin()
	Δ := 9.
	var x, y, z float64
	var JDE float64
	f := func() {
		τ := base.LightTime(Δ)
		JDE = jde - τ
		l, b, r := saturn.Position(JDE)
		l, b = pp.ToFK5(l, b, JDE)
		sl, cl := l.Sincos()
		sb, cb := b.Sincos()
		x = r*cb*cl + R*cs
		y = r*cb*sl + R*ss
		z = r*sb + R*sβ
		Δ = math.Sqrt(x*x + y*y + z*z)
	}
	f()
	f()
	λ0 := unit.Angle(math.Atan2(y, x))
	β0 := unit.Angle(math.Atan(z / math.Hypot(x, y)))
	ecl := &coord.Ecliptic{λ0, β0}
	precess.EclipticPosition(ecl, ecl,
		base.JDEToJulianYear(jde), base.JDEToJulianYear(base.B1950), 0, 0)
	λ0, β0 = ecl.Lon, ecl.Lat
	q := newQs(JDE)
	s4 := [9]r4{{}, // 0 unused
		q.mimas(),
		q.enceladus(),
		q.tethys(),
		q.dione(),
		q.rhea(),
		q.titan(),
		q.hyperion(),
		q.iapetus(),
	}
	var X, Y, Z [9]float64
	for j := 1; j <= 8; j++ {
		u := s4[j].λ - s4[j].Ω
		w := s4[j].Ω - 168.8112*d
		su, cu := math.Sincos(u)
		sw, cw := math.Sincos(w)
		sγ, cγ := math.Sincos(s4[j].γ)
		r := s4[j].r
		X[j] = r * (cu*cw - su*cγ*sw)
		Y[j] = r * (su*cw*cγ + cu*sw)
		Z[j] = r * su * sγ
	}
	Z[0] = 1
	sλ0, cλ0 := λ0.Sincos()
	sβ0, cβ0 := β0.Sincos()
	var A, B, C [9]float64
	for j := range X {
		a := X[j]
		b := q.c1*Y[j] - q.s1*Z[j]
		c := q.s1*Y[j] + q.c1*Z[j]
		a, b =
			q.c2*a-q.s2*b,
			q.s2*a+q.c2*b
		A[j], b =
			a*sλ0-b*cλ0,
			a*cλ0+b*sλ0
		B[j], C[j] =
			b*cβ0+c*sβ0,
			c*cβ0-b*sβ0
	}
	D := math.Atan2(A[0], C[0])
	sD, cD := math.Sincos(D)
	for j := 1; j <= 8; j++ {
		X[j] = A[j]*cD - C[j]*sD
		Y[j] = A[j]*sD + C[j]*cD
		Z[j] = B[j]
		d := X[j] / s4[j].r
		X[j] += math.Abs(Z[j]) / k[j] * math.Sqrt(1-d*d)
		W := Δ / (Δ + Z[j]/2475)
		pos[j-1].X = X[j] * W
		pos[j-1].Y = Y[j] * W
	}
	return
}