| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Astro::Montenbruck::NutEqu; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 933 | use strict; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 93 |  | 
| 4 | 3 |  |  | 3 |  | 18 | use warnings; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 114 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 3 |  |  | 3 |  | 18 | use Exporter qw/import/; | 
|  | 3 |  |  |  |  | 4 |  | 
|  | 3 |  |  |  |  | 97 |  | 
| 7 | 3 |  |  | 3 |  | 16 | use Math::Trig qw/:pi/; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 349 |  | 
| 8 | 3 |  |  | 3 |  | 23 | use Astro::Montenbruck::MathUtils qw/frac ARCS polynome/; | 
|  | 3 |  |  |  |  | 4 |  | 
|  | 3 |  |  |  |  | 1402 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | our @EXPORT_OK = qw/mean2true obliquity deltas/; | 
| 11 |  |  |  |  |  |  | our $VERSION = 0.01; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub deltas { | 
| 14 | 7 |  |  | 7 | 1 | 2346 | my $t    = shift; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 7 |  |  |  |  | 34 | my $ls   = pi2 * frac( 0.993133 + 99.997306 * $t );    # mean anomaly Sun | 
| 17 | 7 |  |  |  |  | 27 | my $d    = pi2 * frac( 0.827362 + 1236.853087 * $t );  # diff. longitude Moon-Sun | 
| 18 | 7 |  |  |  |  | 29 | my $f    = pi2 * frac( 0.259089 + 1342.227826 * $t );  # mean argument of latitude | 
| 19 | 7 |  |  |  |  | 25 | my $n    = pi2 * frac( 0.347346 - 5.372447 * $t );     # longit. ascending node | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 7 |  |  |  |  | 124 | my $dpsi = | 
| 22 |  |  |  |  |  |  | ( -17.200 * sin($n) - | 
| 23 |  |  |  |  |  |  | 1.319 * sin( 2 * ( $f - $d + $n ) ) - | 
| 24 |  |  |  |  |  |  | 0.227 * sin( 2 * ( $f + $n ) ) + | 
| 25 |  |  |  |  |  |  | 0.206 * sin( 2 * $n ) + | 
| 26 |  |  |  |  |  |  | 0.143 * sin($ls) ) / ARCS; | 
| 27 | 7 |  |  |  |  | 58 | my $deps = | 
| 28 |  |  |  |  |  |  | ( +9.203 * cos($n) + | 
| 29 |  |  |  |  |  |  | 0.574 * cos( 2 * ( $f - $d + $n ) ) + | 
| 30 |  |  |  |  |  |  | 0.098 * cos( 2 * ( $f + $n ) ) - | 
| 31 |  |  |  |  |  |  | 0.090 * cos( 2 * $n ) ) / ARCS; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 7 |  |  |  |  | 29 | $dpsi, $deps | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | sub mean2true { | 
| 37 | 5 |  |  | 5 | 1 | 4113 | my $t = shift; | 
| 38 | 5 |  |  |  |  | 20 | my ($dpsi, $deps) = deltas($t); | 
| 39 | 5 |  |  |  |  | 14 | my $eps  = 0.4090928 - 2.2696E-4 * $t; # obliquity of the ecliptic | 
| 40 | 5 |  |  |  |  | 13 | my $c  = $dpsi * cos($eps); | 
| 41 | 5 |  |  |  |  | 12 | my $s  = $dpsi * sin($eps); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub { | 
| 44 | 19 |  |  | 19 |  | 49 | my ($x, $y, $z) = @_; | 
| 45 | 19 |  |  |  |  | 49 | my $dx = -( $c * $y + $s * $z ); | 
| 46 | 19 |  |  |  |  | 38 | my $dy =  ( $c * $x - $deps * $z ); | 
| 47 | 19 |  |  |  |  | 39 | my $dz =  ( $s * $x + $deps * $y ); | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 19 |  |  |  |  | 67 | $x + $dx, $y + $dy, $z + $dz | 
| 50 |  |  |  |  |  |  | } | 
| 51 | 5 |  |  |  |  | 39 | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub obliquity { | 
| 54 | 2 |  |  | 2 | 1 | 2528 | my $t = shift; | 
| 55 | 2 |  |  |  |  | 15 | 23.43929111 - (46.815 + (0.00059 - 0.001813 * $t) * $t) * $t / 3600 | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | 1; | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | __END__ | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =pod | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =encoding UTF-8 | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =head1 NAME | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | Astro::Montenbruck::Ephemeris::Planet - Base class for a planet. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | # given mean geocentric coordinates $x0, $y0, $z0, | 
| 75 |  |  |  |  |  |  | # transform them to apparent coordinates $x1, $y1, $z1 | 
| 76 |  |  |  |  |  |  | my $func = nutequ( $t ); | 
| 77 |  |  |  |  |  |  | ($x1, $y1, $z1) = $func->($x0, $y0, $z0); # true coordinates | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | Base class for a planet. Designed to be extended. Used internally in | 
| 82 |  |  |  |  |  |  | Astro::Montenbruck::Ephemeris modules. Subclasses must implement B<heliocentric> | 
| 83 |  |  |  |  |  |  | method. | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head1 SUBROUTINES | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =head2 deltas( $t ) | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | Calculates the effects of nutation on the ecliptic longitude and on the | 
| 90 |  |  |  |  |  |  | obliquity of the ecliptic with accuracy of about 1 arcsecond. | 
| 91 |  |  |  |  |  |  | Given time in Julian centuries since J200, return delta-psi and delta-eps. | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =head3 Arguments | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =over | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =item * B<$t> â time in Julian centuries since J2000: C<(JD-2451545.0)/36525.0> | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =back | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head3 Returns | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | C<($delta_psi, $delta_eps)>, in arc-degrees. | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | =head2 mean2true( $t ) | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | Returns function for transforming of mean to true coordinates. | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | =head3 Arguments | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =over | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =item * B<$t> â time in Julian centuries since J2000: C<(JD-2451545.0)/36525.0> | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | =back | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | =head3 Returns | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | Function which takes I<mean> ecliptic geocentric coordinates of the planet X, Y, Z | 
| 121 |  |  |  |  |  |  | of a planet and returns I<true> coordinates, i.e. corrected for | 
| 122 |  |  |  |  |  |  | L<nutation in ecliptic and obliquity>. | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =head2 obliquity( $t ) | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | Given time in Julian centuries since J200, return I<mean obliquity of the ecliptic>, | 
| 127 |  |  |  |  |  |  | in arc-degrees. | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =head1 AUTHOR | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | Sergey Krushinsky, C<< <krushi at cpan.org> >> | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | Copyright (C) 2009-2019 by Sergey Krushinsky | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 138 |  |  |  |  |  |  | it under the same terms as Perl itself. | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =cut |