Esempio n. 1
0
// TopocentricEcliptical returns topocentric ecliptical coordinates including parallax.
//
// Arguments λ, β are geocentric ecliptical longitude and latitude of a body,
// s is its geocentric semidiameter. φ, h are the observer's latitude and
// and height above the ellipsoid in meters.  ε is the obliquity of the
// ecliptic, θ is local sidereal time, π is equatorial horizontal parallax
// of the body (see Horizonal()).
//
// Results are observed topocentric coordinates and semidiameter.
func TopocentricEcliptical(λ, β, s, φ unit.Angle, h float64, ε unit.Angle, θ unit.Time, π unit.Angle) (λʹ, βʹ, sʹ unit.Angle) {
	S, C := globe.Earth76.ParallaxConstants(φ, h)
	sλ, cλ := λ.Sincos()
	sβ, cβ := β.Sincos()
	sε, cε := ε.Sincos()
	sθ, cθ := θ.Angle().Sincos()
	sπ := π.Sin()
	N := cλ*cβ - C*sπ*cθ
	λʹ = unit.Angle(math.Atan2(sλ*cβ-sπ*(S*sε+C*cε*sθ), N))
	if λʹ < 0 {
		λʹ += 2 * math.Pi
	}
	cλʹ := λʹ.Cos()
	βʹ = unit.Angle(math.Atan(cλʹ * (sβ - sπ*(S*cε-C*sε*sθ)) / N))
	sʹ = unit.Angle(math.Asin(cλʹ * βʹ.Cos() * s.Sin() / N))
	return
}
Esempio n. 2
0
// ApproxTimes computes approximate UT rise, transit and set times for
// a celestial object on a day of interest.
//
// The function argurments do not actually include the day, but do include
// values computed from the day.
//
//	p is geographic coordinates of observer.
//	h0 is "standard altitude" of the body.
//	Th0 is apparent sidereal time at 0h UT at Greenwich.
//	α, δ are right ascension and declination of the body.
//
// Th0 must be the time on the day of interest.
// See sidereal.Apparent0UT.
//
// α, δ must be values at 0h dynamical time for the day of interest.
func ApproxTimes(p globe.Coord, h0 unit.Angle, Th0 unit.Time, α unit.RA, δ unit.Angle) (tRise, tTransit, tSet unit.Time, err error) {
	// approximate local hour angle
	sLat, cLat := p.Lat.Sincos()
	sδ1, cδ1 := δ.Sincos()
	cH0 := (h0.Sin() - sLat*sδ1) / (cLat * cδ1) // (15.1) p. 102
	if cH0 < -1 || cH0 > 1 {
		err = ErrorCircumpolar
		return
	}
	H0 := unit.TimeFromRad(math.Acos(cH0))

	// approximate transit, rise, set times.
	// (15.2) p. 102.
	mt := unit.TimeFromRad(α.Rad()+p.Lon.Rad()) - Th0
	tTransit = mt.Mod1()
	tRise = (mt - H0).Mod1()
	tSet = (mt + H0).Mod1()
	return
}
Esempio n. 3
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()) / Δ)
}
Esempio n. 4
0
// Saturn84 computes the visual magnitude of Saturn.
//
// The formula is that adopted in "Astronomical Almanac" in 1984.
//
// Argument r is the planet's distance from the Sun, Δ the distance from Earth.
// B is the Saturnicentric latitude of the Earth referred to the plane of
// Saturn's ring. ΔU is the difference between the Saturnicentric longitudes
// of the Sun and the Earth, measured in the plane of the ring.
func Saturn84(r, Δ float64, B, ΔU unit.Angle) float64 {
	s := math.Abs(B.Sin())
	return -8.88 + 5*math.Log10(r*Δ) + .044/math.Abs(ΔU.Deg()) -
		2.6*s + 1.25*s*s
}