Module: AstroChart::Astrocartography

Defined in:
lib/astro_chart/astrocartography.rb

Overview

Astrocartography (星象地圖 / relocational lines).

For a fixed birth instant, every body is angular (on the horizon or the meridian) along particular curves across the globe. We return, per body, four lines in geographic coordinates (longitude east-positive, −180..180):

MC  — the body culminates on the upper meridian (a vertical meridian).
IC  — the body is on the lower meridian (a vertical meridian).
ASC — the body rises on the eastern horizon (a curve of latitude points).
DSC — the body sets on the western horizon (a curve of latitude points).

Method (Meeus, positional astronomy): from the body's apparent ecliptic longitude λ and the true obliquity ε we form its equatorial coordinates (RA α, Dec δ); with the Greenwich apparent sidereal time (GST):

MC longitude  = α − GST
IC longitude  = α − GST + 180°

and at latitude φ the body is on the horizon when its hour angle is H = ±arccos(−tanφ·tanδ) (no solution ⇒ circumpolar, the line ends), rising at H = −H0 (eastern), setting at H = +H0 (western), giving longitude = α + H − GST.

RA/Dec use each body's true apparent ecliptic latitude (via Ephemeris.ecliptic_latlon), so the lines are accurate for the high-latitude bodies (Moon, Pluto) too — not just longitude-only approximations.

Constant Summary collapse

Core =
Pure::Core
DEG2RAD =
Core::DEG2RAD
RAD2DEG =
Core::RAD2DEG
BODIES =

The ten bodies conventionally mapped.

["太陽", "月亮", "水星", "金星", "火星", "木星",
"土星", "天王星", "海王星", "冥王星"].freeze
LAT_MIN =

Latitude span and step for the rising/setting curves (degrees).

-75
LAT_MAX =
75
LAT_STEP =
1

Class Method Summary collapse

Class Method Details

.lines(jd_ut) ⇒ Object

jd_ut: birth Julian Day (UT). Returns Array of:

{ "planet" => "太陽",
"mc" => <lon>, "ic" => <lon>,            # single geographic longitudes
"asc" => [ [ [lat,lon], ... ], ... ],    # rising curve, as segments
"dsc" => [ [ [lat,lon], ... ], ... ] }   # setting curve, as segments


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/astro_chart/astrocartography.rb', line 51

def lines(jd_ut)
  gst = Core.apparent_sidereal_deg(jd_ut)
  eps = Core.true_obliquity(Core.jd_tt(jd_ut)) * DEG2RAD

  BODIES.map do |name|
    lam_deg, beta_deg = Ephemeris.ecliptic_latlon(jd_ut, Ephemeris::PLANETS[name])
    lam = lam_deg * DEG2RAD
    beta = beta_deg * DEG2RAD
    # RA/Dec from apparent ecliptic longitude, latitude and obliquity
    # (Meeus, Astronomical Algorithms, eqs. 13.3–13.4).
    ra = Core.norm360(Math.atan2(
      Math.sin(lam) * Math.cos(eps) - Math.tan(beta) * Math.sin(eps),
      Math.cos(lam)
    ) * RAD2DEG)
    dec = Math.asin(Math.sin(beta) * Math.cos(eps) + Math.cos(beta) * Math.sin(eps) * Math.sin(lam))

    {
      "planet" => name,
      "mc"     => norm180(ra - gst),
      "ic"     => norm180(ra - gst + 180.0),
      "asc"    => horizon_curve(ra, dec, gst, :rising),
      "dsc"    => horizon_curve(ra, dec, gst, :setting),
    }
  end
end