Beispiel #1
0
func ExampleHorizontal() {
	// Example 40.a, p. 280
	π := parallax.Horizontal(.37276)
	fmt.Printf("%.3s", sexa.FmtAngle(π))
	// Output:
	// 23.592″
}
Beispiel #2
0
func ExampleHorizontal() {
	// Example 40.a, p. 280
	π := parallax.Horizontal(.37276)
	fmt.Printf("%.3f\n", π*180/math.Pi*60*60)
	// Output:
	// 23.592
}
Beispiel #3
0
func TestHorizontal(t *testing.T) {
	// example from moonposition.Parallax, ch 47, p. 342
	_, _, Δ := moonposition.Position(julian.CalendarGregorianToJD(1992, 4, 12))
	π := parallax.Horizontal(Δ / base.AU).Deg()
	want := .99199
	// we don't quite get all the digits here.
	// for close objects we need that Arcsin that's in moonposition.Parallax.
	if math.Abs(π-want) > .0001 {
		t.Fatal("got", π, "want", want)
	}
}
Beispiel #4
0
// MoonTopocentric returns observed topocentric semidiameter of the Moon.
//
//	Δ is distance to Moon in AU.
//	δ is declination of Moon in radians.
//	H is hour angle of Moon in radians.
//	ρsφʹ, ρcφʹ are parallax constants as returned by
//	    globe.Ellipsoid.ParallaxConstants, for example.
//
// Result is semidiameter in radians.
func MoonTopocentric(Δ, δ, H, ρsφʹ, ρcφʹ float64) float64 {
	const k = .272481
	sπ := math.Sin(parallax.Horizontal(Δ))
	// q computed by (40.6, 40.7) p. 280, ch 40.
	sδ, cδ := math.Sincos(δ)
	sH, cH := math.Sincos(H)
	A := cδ * sH
	B := cδ*cH - ρcφʹ*sπ
	C := sδ - ρsφʹ*sπ
	q := math.Sqrt(A*A + B*B + C*C)
	return k / q * sπ
}
Beispiel #5
0
// MoonTopocentric returns observed topocentric semidiameter of the Moon.
//
//	Δ is distance to Moon in AU.
//	δ is declination of Moon.
//	H is hour angle of Moon.
//	ρsφʹ, ρcφʹ are parallax constants as returned by
//	    globe.Ellipsoid.ParallaxConstants, for example.
func MoonTopocentric(Δ float64, δ unit.Angle, H unit.HourAngle, ρsφʹ, ρcφʹ float64) float64 {
	const k = .272481
	sπ := parallax.Horizontal(Δ).Sin()
	// q computed by (40.6, 40.7) p. 280, ch 40.
	sδ, cδ := δ.Sincos()
	sH, cH := H.Sincos()
	A := cδ * sH
	B := cδ*cH - ρcφʹ*sπ
	C := sδ - ρsφʹ*sπ
	q := math.Sqrt(A*A + B*B + C*C)
	return k / q * sπ
}
Beispiel #6
0
// MoonTopocentric2 returns observed topocentric semidiameter of the Moon
// by a less rigorous method.
//
// Δ is distance to Moon in AU, h is altitude of the Moon above the observer's
// horizon in radians.
//
// Result is semidiameter in radians.
func MoonTopocentric2(Δ, h float64) float64 {
	return Moon / Δ * (1 + math.Sin(h)*math.Sin(parallax.Horizontal(Δ)))
}
Beispiel #7
0
// MoonTopocentric2 returns observed topocentric semidiameter of the Moon
// by a less rigorous method.
//
// Δ is distance to Moon in AU, h is altitude of the Moon above the observer's
// horizon.
func MoonTopocentric2(Δ float64, h unit.Angle) unit.Angle {
	return Moon.Mul((1 + h.Sin()*parallax.Horizontal(Δ).Sin()) / Δ)
}