line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::Coord::ECI::VSOP87D::_Superior; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
1067
|
use 5.008; |
|
7
|
|
|
|
|
34
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
60
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
132
|
|
6
|
7
|
|
|
7
|
|
224
|
use warnings; |
|
7
|
|
|
|
|
36
|
|
|
7
|
|
|
|
|
291
|
|
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
46
|
use base qw{ Astro::Coord::ECI }; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
1019
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
|
|
482
|
use Astro::Coord::ECI::Mixin qw{ |
11
|
|
|
|
|
|
|
almanac almanac_hash |
12
|
|
|
|
|
|
|
next_quarter_hash |
13
|
7
|
|
|
7
|
|
2805
|
}; |
|
7
|
|
|
|
|
6234
|
|
14
|
7
|
|
|
7
|
|
85
|
use Astro::Coord::ECI::Utils qw{ PI PIOVER2 find_first_true mod2pi }; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
443
|
|
15
|
7
|
|
|
7
|
|
3204
|
use Astro::Coord::ECI::VSOP87D qw{ :mixin }; |
|
7
|
|
|
|
|
38
|
|
|
7
|
|
|
|
|
1610
|
|
16
|
7
|
|
|
7
|
|
79
|
use Carp; |
|
7
|
|
|
|
|
26
|
|
|
7
|
|
|
|
|
7338
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
10
|
|
|
10
|
1
|
4228
|
my ( $class, %arg ) = @_; |
22
|
10
|
|
|
|
|
98
|
$class->__default( \%arg ); |
23
|
10
|
|
|
|
|
131
|
return $class->SUPER::new( %arg ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub __almanac_event_type_iterator { |
27
|
0
|
|
|
0
|
|
0
|
my ( $self, $station ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my $inx = 0; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
my $horizon = $station->__get_almanac_horizon(); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
my @events = ( |
34
|
|
|
|
|
|
|
[ $station, next_elevation => [ $self, $horizon, 1 ], |
35
|
|
|
|
|
|
|
horizon => '__horizon_name' ], |
36
|
|
|
|
|
|
|
[ $station, next_meridian => [ $self ], |
37
|
|
|
|
|
|
|
transit => '__transit_name' ], |
38
|
|
|
|
|
|
|
[ $self, next_quarter => [], 'quarter', '__quarter_name' ], |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return sub { |
42
|
|
|
|
|
|
|
$inx < @events |
43
|
0
|
0
|
|
0
|
|
0
|
and return @{ $events[$inx++] }; |
|
0
|
|
|
|
|
0
|
|
44
|
0
|
|
|
|
|
0
|
return; |
45
|
0
|
|
|
|
|
0
|
}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
my $get = sub { |
50
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
51
|
|
|
|
|
|
|
return $self->__get_attr()->{$name}; |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my %accessor = ( |
55
|
|
|
|
|
|
|
model_cutoff => $get, |
56
|
|
|
|
|
|
|
nutation_cutoff => $get, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub attribute { |
60
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $name ) = @_; |
61
|
0
|
0
|
|
|
|
0
|
exists $accessor{$name} |
62
|
|
|
|
|
|
|
and return __PACKAGE__; |
63
|
0
|
|
|
|
|
0
|
return $self->SUPER::attribute( $name ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get { |
67
|
4777
|
|
|
4777
|
1
|
109244
|
my ( $self, @arg ) = @_; |
68
|
4777
|
|
|
|
|
7214
|
my @rslt; |
69
|
4777
|
|
|
|
|
8978
|
foreach my $name ( @arg ) { |
70
|
4777
|
100
|
|
|
|
11988
|
if ( my $code = $accessor{$name} ) { |
71
|
2279
|
|
|
|
|
4766
|
push @rslt, $code->( $self, $name ); |
72
|
|
|
|
|
|
|
} else { |
73
|
2498
|
|
|
|
|
9069
|
push @rslt, $self->SUPER::get( $name ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
wantarray |
76
|
4777
|
100
|
|
|
|
60481
|
or return $rslt[0]; |
77
|
|
|
|
|
|
|
} |
78
|
40
|
|
|
|
|
724
|
return @rslt; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# NOTE that the %opt arguments are UNSUPPORTED and can be changed or |
83
|
|
|
|
|
|
|
# removed without notice. Caveat coder. |
84
|
|
|
|
|
|
|
sub next_quarter { |
85
|
25
|
|
|
25
|
1
|
3378
|
my ( $self, $quarter, %opt ) = @_; |
86
|
|
|
|
|
|
|
|
87
|
25
|
|
|
|
|
95
|
my $time = $self->universal(); |
88
|
|
|
|
|
|
|
|
89
|
25
|
|
|
|
|
423
|
my $increment = $self->synodic_period() / 16; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my @checker = ( |
92
|
|
|
|
|
|
|
sub { # 0 = conjunction |
93
|
165
|
|
|
165
|
|
2455
|
my ( $time ) = @_; |
94
|
165
|
100
|
|
|
|
691
|
return $self->__longitude_from_sun( $time ) < 0 ? 4 : 0; |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
sub { # 1 = west quadrature |
97
|
165
|
|
|
165
|
|
2436
|
my ( $time ) = @_; |
98
|
165
|
100
|
|
|
|
570
|
return $self->__longitude_from_sun( $time, - PIOVER2 ) < 0 ? 1 : 0; |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
sub { # 2 = opposition |
101
|
327
|
|
|
327
|
|
4218
|
my ( $time ) = @_; |
102
|
327
|
100
|
|
|
|
1011
|
return $self->__longitude_from_sun( $time, PI ) < 0 ? 2 : 0; |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
sub { # 3 = east quadrature |
105
|
157
|
|
|
157
|
|
2223
|
my ( $time ) = @_; |
106
|
157
|
100
|
|
|
|
544
|
return $self->__longitude_from_sun( $time, PIOVER2 ) < 0 ? 3 : 0; |
107
|
|
|
|
|
|
|
}, |
108
|
25
|
|
|
|
|
716
|
); |
109
|
|
|
|
|
|
|
|
110
|
25
|
50
|
|
|
|
127
|
if ( defined $opt{checker_result} ) { |
111
|
0
|
|
|
|
|
0
|
return $checker[$opt{checker_result}]->( $time ); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
25
|
|
|
|
|
57
|
my $test; |
115
|
25
|
100
|
|
|
|
100
|
if ( defined $quarter ) { |
116
|
5
|
|
|
|
|
18
|
$test = $checker[$quarter]; |
117
|
5
|
|
|
|
|
25
|
while ( $test->( $time ) ) { |
118
|
13
|
|
|
|
|
126
|
$time += $increment; |
119
|
|
|
|
|
|
|
} |
120
|
5
|
|
|
|
|
68
|
while ( ! $test->( $time ) ) { |
121
|
37
|
|
|
|
|
316
|
$time += $increment; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
} else { |
124
|
20
|
50
|
|
|
|
76
|
my @chk = grep { ! $_->( $time ) } @checker |
|
80
|
|
|
|
|
672
|
|
125
|
|
|
|
|
|
|
or confess 'Programming error - no false checks'; |
126
|
20
|
|
|
|
|
218
|
my $rslt; |
127
|
20
|
|
|
|
|
61
|
while ( ! $rslt ) { |
128
|
80
|
|
|
|
|
526
|
$time += $increment; |
129
|
80
|
|
|
|
|
560
|
foreach my $c ( @chk ) { |
130
|
145
|
100
|
|
|
|
955
|
$rslt = $c->( $time ) |
131
|
|
|
|
|
|
|
and last; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
20
|
|
|
|
|
233
|
$quarter = $rslt % 4; |
135
|
20
|
|
|
|
|
458
|
$test = $checker[$quarter]; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
25
|
|
|
|
|
208
|
my $rslt = find_first_true( $time - $increment, $time, $test ); |
139
|
|
|
|
|
|
|
|
140
|
25
|
|
|
|
|
640
|
$self->universal( $rslt ); |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
wantarray |
143
|
25
|
50
|
|
|
|
434
|
or return $rslt; |
144
|
25
|
|
|
|
|
167
|
return( $rslt, $quarter, $self->__quarter_name( $quarter ) ); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub __quarter_name { |
148
|
25
|
|
|
25
|
|
93
|
my ( $self, $event, $name ) = @_; |
149
|
25
|
|
50
|
|
|
187
|
$name ||= [ |
150
|
|
|
|
|
|
|
'%s conjunction', |
151
|
|
|
|
|
|
|
'%s west quadrature', |
152
|
|
|
|
|
|
|
'%s opposition', |
153
|
|
|
|
|
|
|
'%s east quadrature', |
154
|
|
|
|
|
|
|
]; |
155
|
25
|
|
|
|
|
117
|
return sprintf $name->[$event], $self->get( 'name' ); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
{ |
159
|
|
|
|
|
|
|
my %mutator = ( |
160
|
|
|
|
|
|
|
model_cutoff => \&__mutate_model_cutoff, |
161
|
|
|
|
|
|
|
nutation_cutoff => \&__mutate_nutation_cutoff, |
162
|
|
|
|
|
|
|
); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub set { |
165
|
20
|
|
|
20
|
1
|
447
|
my ( $self, @arg ) = @_; |
166
|
20
|
|
|
|
|
74
|
while ( @arg ) { |
167
|
65
|
|
|
|
|
1331
|
my ( $name, $value ) = splice @arg, 0, 2; |
168
|
65
|
100
|
|
|
|
194
|
if ( my $code = $mutator{$name} ) { |
169
|
20
|
|
|
|
|
79
|
$code->( $self, $name, $value ); |
170
|
|
|
|
|
|
|
} else { |
171
|
45
|
|
|
|
|
144
|
$self->SUPER::set( $name, $value ); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
} |
174
|
20
|
|
|
|
|
633
|
return $self; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
__END__ |