Astro:...:Planet(3pm)
π« 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 fromAstro::Montenbruck::Ephemeris::Planet::Sun::sunpos($t)$nut_funcβ the function that converts geocentric coordinates from mean to true equinox of date. This comes fromAstro::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 AND LICENSE π
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
- alpine 3.24: perl-astro-montenbruck-doc 1.26-r1 Β· Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms