Astro:...:Planet(3pm)

πŸ“¦ version 1.26, in alpine 3.24

πŸ’« NAME πŸ’«

Astro::Montenbruck::Ephemeris::Planet β€” the base class for a planet, bestie. It's the blueprint, the mother of planets, the moment before the glow-up. πŸͺ

(Oh and hey β€” this whole page lives in the Astro:...:Planet(3pm) section of the Perl docs, just so you know where you are πŸ’–)


✨ SYNOPSIS ✨

Okay so here's how you actually use it β€” you subclass it like this:

package Astro::Montenbruck::Ephemeris::Planet::Mercury;
use base qw/Astro::Montenbruck::Ephemeris::Planet/;
...

sub  heliocentric {
  # implement the method
}

That's literally it. You inherit everything, you write the one method, you're iconic. πŸ’…


🌸 DESCRIPTION 🌸

So Astro::Montenbruck::Ephemeris::Planet is the base class for a planet. It's designed to be extended β€” like, it's not doing the work itself, it's the vibe-setter, the main character that hands out the family inheritance. 🫢

It's used internally inside the Astro::Montenbruck::Ephemeris modules, so if you're here it's probably because you're building your own planet subclass. And heads up: subclasses must implement heliocentric. No getting around it, no shortcuts, fr fr. 😭


πŸ”₯ SUBROUTINES/METHODS πŸ”₯

🌟 $planet = Astro::Montenbruck::Ephemeris::Planet->new( $id )

The constructor, obviously. $id is the identifier from the @PLANETS array β€” you know, the one down in "EXPORTED CONSTANTS". So like, pass in $ME if you want Mercury, $JU for Jupiter, etc. πŸ’«

🌈 $self->apparent($t, $lbr, $sun, $nut_func)

This one gives you the geocentric ecliptic coordinates of a planet, referred to the true equinox of date. Which is giving "where does it look like it is from Earth right now" energy. 🌍✨

πŸ’œ Arguments

  • $t β€” time in Julian centuries since J2000, and the formula is literally: (JD-2451545.0) / 36525.0
  • $lbr β€” an arrayref of the heliocentric coordinates of the planet, the kind you get back from $self->heliocentric($t)
  • $sun β€” the ecliptic geocentric coordinates of the Sun, as a hashref with 'l', 'b', and 'r' keys. You get this from Astro::Montenbruck::Ephemeris::Planet::Sun::sunpos($t)
  • $nut_func β€” the function that converts geocentric coordinates from mean to true equinox of date. This comes from Astro::Montenbruck::NutEqu::mean2true($t)

πŸŽ€ Returns

An array of geocentric ecliptical coordinates β€” three of them, in this order:

  • longitude, in arc-degrees
  • latitude, in arc-degrees
  • distance from Earth, in AU

πŸ¦‹ $self->heliocentric($t)

Okay so given the time in centuries since epoch 2000.0, this calculates the heliocentric ecliptical coordinates ($l, $b, $r). Sun-centred coords, no cap. β˜€οΈ

  • $l β€” longitude, arc-degrees
  • $b β€” latitude, arc-degrees
  • $r β€” distance from Earth, A.U.
Also reminder from up top: this is the method every single subclass has to implement. It's the whole assignment. πŸ’€

πŸ‘‘ EXPORTED CONSTANTS πŸ‘‘

These are the little planet IDs you'll be passing around β€” memorise them, they're your new besties:

  • $MO β€” Moon πŸŒ™
  • $SU β€” Sun β˜€οΈ
  • $ME β€” Mercury
  • $VE β€” Venus πŸ’–
  • $MA β€” Mars πŸ”΄
  • $JU β€” Jupiter
  • $SA β€” Saturn πŸͺ
  • $UR β€” Uranus
  • $NE β€” Neptune πŸ”΅
  • $PL β€” Pluto (still a planet in our hearts, don't @ me)
  • @PLANETS β€” the array containing every single id listed above. All of them. The whole squad. 🫢

⭐ AUTHOR ⭐

Sergey Krushinsky, "<krushi at cpan.org>" β€” thank you king, we appreciate you πŸ’œ


Copyright (C) 2009-2022 by Sergey Krushinsky

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page bestie, you're officially a Planet subclass expert now πŸ’…βœ¨

This little gem is served up by perl v5.42.2, dated 2026-02-15 β€” mwah, go build something celestial πŸͺπŸ’–

πŸ“¦ where this page comes from