lib/Astro/Montenbruck/Ephemeris/Planet/Pluto.pm

filter: Statementstmt 100% 107 / 107 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 100% 2 / 2 totaltotal 100% 124 / 124 CC 2 SCAR 1.3
CC
2
Cov
100%
_prec
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« lib/Astro/Montenbruck/Ephemeris/Planet/Moon.pm ↑ Summary lib/Astro/Montenbruck/Ephemeris/Planet.pm »
1 package Astro::Montenbruck::Ephemeris::Planet::Pluto;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use POSIX qw/atan/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Math::Trig qw/:pi deg2rad/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use base qw/Astro::Montenbruck::Ephemeris::Planet/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Astro::Montenbruck::Ephemeris::Planet qw/$PL/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use Astro::Montenbruck::Ephemeris::Pert qw/pert/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Astro::Montenbruck::MathUtils qw /frac ARCS/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 our $VERSION = 0.01;
15  
16 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
17 6 my $class = shift;
18 6 $class->SUPER::new( id => $PL );
19 }
20  
21  
22 6 ▶sub heliocentric {
Subroutine heliocentric: called CC=1 SCAR=0.0
Pod documented
23 6 my ( $self, $t ) = @_;
24  
25 # Mean anomalies of planets in [rad]
26 6 my $m5 = pi2 * frac( 0.0565314 + 8.4302963 * $t );
27 6 my $m6 = pi2 * frac( 0.8829867 + 3.3947688 * $t );
28 6 my $m9 = pi2 * frac( 0.0385795 + 0.4026667 * $t );
29  
30 6 my ( $dl, $dr, $db ) = ( 0, 0, 0 ); # Corrections in longitude ["],
31 6 ▶ my $pert_cb = sub { $dl += $_[0]; $dr += $_[1]; $db += $_[2] };
Subroutine __ANON__: called CC=1 SCAR=0.0
32  
33 # Perturbations by Pluto
34 6 my $term = pert(
35 T => $t,
36 M => $m9,
37 m => $m5,
38 I_min => 0,
39 I_max => 6,
40 i_min => -2,
41 i_max => 1,
42 callback => $pert_cb
43 );
44  
45 6 $term->( 1, 0, 0, 0.06, 100924.08, -960396.0, 15965.1, 51987.68, -24288.76 );
46 6 $term->( 2, 0, 0, 3274.74, 17835.12, -118252.2, 3632.4, 12687.49, -6049.72 );
47 6 $term->( 3, 0, 0, 1543.52, 4631.99, -21446.6, 1167.0, 3504.00, -1853.10 );
48 6 $term->( 4, 0, 0, 688.99, 1227.08, -4823.4, 213.5, 1048.19, -648.26 );
49 6 $term->( 5, 0, 0, 242.27, 415.93, -1075.4, 140.6, 302.33, -209.76 );
50 6 $term->( 6, 0, 0, 138.41, 110.91, -308.8, -55.3, 109.52, -93.82 );
51 6 $term->( 3, -1, 0, -0.99, 5.06, -25.6, 19.8, 1.26, -1.96 );
52 6 $term->( 2, -1, 0, 7.15, 5.61, -96.7, 57.2, 1.64, -2.16 );
53 6 $term->( 1, -1, 0, 10.79, 23.13, -390.4, 236.4, -0.33, 0.86 );
54 6 $term->( 0, 1, 0, -0.23, 4.43, 102.8, 63.2, 3.15, 0.34 );
55 6 $term->( 1, 1, 0, -1.10, -0.92, 11.8, -2.3, 0.43, 0.14 );
56 6 $term->( 2, 1, 0, 0.62, 0.84, 2.3, 0.7, 0.05, -0.04 );
57 6 $term->( 3, 1, 0, -0.38, -0.45, 1.2, -0.8, 0.04, 0.05 );
58 6 $term->( 4, 1, 0, 0.17, 0.25, 0.0, 0.2, -0.01, -0.01 );
59 6 $term->( 3, -2, 0, 0.06, 0.07, -0.6, 0.3, 0.03, -0.03 );
60 6 $term->( 2, -2, 0, 0.13, 0.20, -2.2, 1.5, 0.03, -0.07 );
61 6 $term->( 1, -2, 0, 0.32, 0.49, -9.4, 5.7, -0.01, 0.03 );
62 6 $term->( 0, -2, 0, -0.04, -0.07, 2.6, -1.5, 0.07, -0.02 );
63  
64 # Perturbations by Saturn
65 6 $term = pert(
66 T => $t,
67 M => $m9,
68 m => $m6,
69 I_min => 0,
70 I_max => 3,
71 i_min => -2,
72 i_max => 1,
73 callback => $pert_cb
74 );
75  
76 6 $term->( 1, -1, 0, -29.47, 75.97, -106.4, -204.9, -40.71, -17.55 );
77 6 $term->( 0, 1, 0, -13.88, 18.20, 42.6, -46.1, 1.13, 0.43 );
78 6 $term->( 1, 1, 0, 5.81, -23.48, 15.0, -6.8, -7.48, 3.07 );
79 6 $term->( 2, 1, 0, -10.27, 14.16, -7.9, 0.4, 2.43, -0.09 );
80 6 $term->( 3, 1, 0, 6.86, -10.66, 7.3, -0.3, -2.25, 0.69 );
81 6 $term->( 2, -2, 0, 4.32, 2.00, 0.0, -2.2, -0.24, 0.12 );
82 6 $term->( 1, -2, 0, -5.04, -0.83, -9.2, -3.1, 0.79, -0.24 );
83 6 $term->( 0, -2, 0, 4.25, 2.48, -5.9, -3.3, 0.58, 0.02 );
84  
85 # Perturbations by Pluto and Saturn
86 6 my $phi = ( $m5 - $m6 );
87 6 my $c = cos($phi);
88 6 my $s = sin($phi);
89 6 $dl += -9.11 * $c + 0.12 * $s;
90 6 $dr += -3.4 * $c - 3.3 * $s;
91 6 $db += +0.81 * $c + 0.78 * $s;
92  
93 6 $phi = ( $m5 - $m6 + $m9 );
94 6 $c = cos($phi);
95 6 $s = sin($phi);
96 6 $dl += +5.92 * $c + 0.25 * $s;
97 6 $dr += +2.3 * $c - 3.8 * $s;
98 6 $db += -0.67 * $c - 0.51 * $s;
99  
100 # Ecliptic coordinates ([rad],[AU])
101 6 my $l = pi2 * frac( 0.6232469 + $m9 / pi2 + $dl / 1296.0E3 );
102 6 my $r = 40.7247248 + $dr * 1.0E-5;
103 6 my $b = deg2rad(-3.909434) + $db / ARCS;
104  
105 # Position vector; ecliptic and equinox of B1950.0
106 6 ( $l, $b ) = _prec( $t, $l, $b );
107  
108 6 $l, $b, $r;
109 }
110  
111 # Intermediate variables for calculating geocentric positions.
112 6 ▶sub _lbr_geo {
Subroutine _lbr_geo: called CC=1 SCAR=0.0
113 6 my ( $self, $t ) = @_;
114  
115 6 my $m = pi2 * frac( 0.0385795 + 0.4026667 * $t );
116 6 my $dl =
117 0.69 + 0.34 * cos($m) + 0.12 * cos( 2 * $m ) + 0.05 * cos( 3 * $m );
118 6 my $dr = 6.66 * sin($m) + 1.64 * sin( 2 * $m );
119 6 my $db = -0.08 * cos($m) - 0.17 * sin($m) - 0.09 * sin( 2 * $m );
120  
121 6 $dl, $db, $dr;
122 }
123  
124 6 ▶sub _prec {
Subroutine _prec: called CC=2 SCAR=6.9
125 6 my ( $t, $l, $b ) = @_;
126  
127 6 my $d = $t + 0.5;
128 6 my $ppi = 3.044;
129  
130 6 my $pk = 2.28E-4 * $d;
131 6 my $p = ( 0.0243764 + 5.39E-6 * $d ) * $d;
132 6 my $c1 = cos($pk);
133 6 my $c2 = cos($b);
134 6 my $c3 = cos( $ppi - $l );
135 6 my $s1 = sin($pk);
136 6 my $s2 = sin($b);
137 6 my $s3 = sin( $ppi - $l );
138 6 my $x = $c2 * $c3;
139 6 my $y = $c1 * $c2 * $s3 - $s1 * $s2;
140 6 my $z = $s1 * $c2 * $s3 + $c1 * $s2;
141  
142 6 $b = atan( $z / sqrt( ( 1.0 - $z ) * ( 1.0 + $z ) ) );
143 6 ▶ if ( $x > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x > 0) { } 4 2 6
144 4 $l = pi2 * frac( ( $ppi + $p - atan( $y / $x ) ) / pi2 );
145 }
146 else {
147 2 $l = pi2 * frac( ( $ppi + $p - atan( $y / $x ) ) / pi2 + 0.5 );
148 }
149  
150 6 $l, $b;
151 }
152  
153 2 1;
154  
155 __END__
« lib/Astro/Montenbruck/Ephemeris/Planet/Moon.pm ↑ Summary lib/Astro/Montenbruck/Ephemeris/Planet.pm »