line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::Coord::ECI::VSOP87D::_Superior; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
1427
|
use 5.008; |
|
7
|
|
|
|
|
30
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
37
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
219
|
|
6
|
7
|
|
|
7
|
|
40
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
262
|
|
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
41
|
use base qw{ Astro::Coord::ECI }; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
930
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
|
|
457
|
use Astro::Coord::ECI::Mixin qw{ |
11
|
|
|
|
|
|
|
almanac almanac_hash |
12
|
|
|
|
|
|
|
next_quarter_hash |
13
|
7
|
|
|
7
|
|
2542
|
}; |
|
7
|
|
|
|
|
5815
|
|
14
|
7
|
|
|
7
|
|
47
|
use Astro::Coord::ECI::Utils qw{ PI PIOVER2 find_first_true mod2pi }; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
378
|
|
15
|
7
|
|
|
7
|
|
2920
|
use Astro::Coord::ECI::VSOP87D qw{ :mixin }; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
1193
|
|
16
|
7
|
|
|
7
|
|
65
|
use Carp; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
7155
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.005_02'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
10
|
|
|
10
|
1
|
4125
|
my ( $class, %arg ) = @_; |
22
|
10
|
|
|
|
|
93
|
$class->__default( \%arg ); |
23
|
10
|
|
|
|
|
106
|
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
|
108424
|
my ( $self, @arg ) = @_; |
68
|
4777
|
|
|
|
|
7060
|
my @rslt; |
69
|
4777
|
|
|
|
|
8903
|
foreach my $name ( @arg ) { |
70
|
4777
|
100
|
|
|
|
11496
|
if ( my $code = $accessor{$name} ) { |
71
|
2279
|
|
|
|
|
4782
|
push @rslt, $code->( $self, $name ); |
72
|
|
|
|
|
|
|
} else { |
73
|
2498
|
|
|
|
|
8398
|
push @rslt, $self->SUPER::get( $name ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
wantarray |
76
|
4777
|
100
|
|
|
|
57827
|
or return $rslt[0]; |
77
|
|
|
|
|
|
|
} |
78
|
40
|
|
|
|
|
667
|
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
|
3495
|
my ( $self, $quarter, %opt ) = @_; |
86
|
|
|
|
|
|
|
|
87
|
25
|
|
|
|
|
104
|
my $time = $self->universal(); |
88
|
|
|
|
|
|
|
|
89
|
25
|
|
|
|
|
400
|
my $increment = $self->synodic_period() / 16; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my @checker = ( |
92
|
|
|
|
|
|
|
sub { # 0 = conjunction |
93
|
165
|
|
|
165
|
|
2222
|
my ( $time ) = @_; |
94
|
165
|
100
|
|
|
|
538
|
return $self->__longitude_from_sun( $time ) < 0 ? 4 : 0; |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
sub { # 1 = west quadrature |
97
|
165
|
|
|
165
|
|
2146
|
my ( $time ) = @_; |
98
|
165
|
100
|
|
|
|
515
|
return $self->__longitude_from_sun( $time, - PIOVER2 ) < 0 ? 1 : 0; |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
sub { # 2 = opposition |
101
|
327
|
|
|
327
|
|
4110
|
my ( $time ) = @_; |
102
|
327
|
100
|
|
|
|
992
|
return $self->__longitude_from_sun( $time, PI ) < 0 ? 2 : 0; |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
sub { # 3 = east quadrature |
105
|
157
|
|
|
157
|
|
2087
|
my ( $time ) = @_; |
106
|
157
|
100
|
|
|
|
487
|
return $self->__longitude_from_sun( $time, PIOVER2 ) < 0 ? 3 : 0; |
107
|
|
|
|
|
|
|
}, |
108
|
25
|
|
|
|
|
664
|
); |
109
|
|
|
|
|
|
|
|
110
|
25
|
50
|
|
|
|
125
|
if ( defined $opt{checker_result} ) { |
111
|
0
|
|
|
|
|
0
|
return $checker[$opt{checker_result}]->( $time ); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
25
|
|
|
|
|
55
|
my $test; |
115
|
25
|
100
|
|
|
|
88
|
if ( defined $quarter ) { |
116
|
5
|
|
|
|
|
22
|
$test = $checker[$quarter]; |
117
|
5
|
|
|
|
|
34
|
while ( $test->( $time ) ) { |
118
|
13
|
|
|
|
|
140
|
$time += $increment; |
119
|
|
|
|
|
|
|
} |
120
|
5
|
|
|
|
|
73
|
while ( ! $test->( $time ) ) { |
121
|
37
|
|
|
|
|
364
|
$time += $increment; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
} else { |
124
|
20
|
50
|
|
|
|
84
|
my @chk = grep { ! $_->( $time ) } @checker |
|
80
|
|
|
|
|
589
|
|
125
|
|
|
|
|
|
|
or confess 'Programming error - no false checks'; |
126
|
20
|
|
|
|
|
198
|
my $rslt; |
127
|
20
|
|
|
|
|
110
|
while ( ! $rslt ) { |
128
|
80
|
|
|
|
|
536
|
$time += $increment; |
129
|
80
|
|
|
|
|
468
|
foreach my $c ( @chk ) { |
130
|
145
|
100
|
|
|
|
937
|
$rslt = $c->( $time ) |
131
|
|
|
|
|
|
|
and last; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
20
|
|
|
|
|
238
|
$quarter = $rslt % 4; |
135
|
20
|
|
|
|
|
394
|
$test = $checker[$quarter]; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
25
|
|
|
|
|
167
|
my $rslt = find_first_true( $time - $increment, $time, $test ); |
139
|
|
|
|
|
|
|
|
140
|
25
|
|
|
|
|
624
|
$self->universal( $rslt ); |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
wantarray |
143
|
25
|
50
|
|
|
|
406
|
or return $rslt; |
144
|
25
|
|
|
|
|
151
|
return( $rslt, $quarter, $self->__quarter_name( $quarter ) ); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub __quarter_name { |
148
|
25
|
|
|
25
|
|
82
|
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
|
|
|
|
|
98
|
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
|
418
|
my ( $self, @arg ) = @_; |
166
|
20
|
|
|
|
|
65
|
while ( @arg ) { |
167
|
65
|
|
|
|
|
1368
|
my ( $name, $value ) = splice @arg, 0, 2; |
168
|
65
|
100
|
|
|
|
181
|
if ( my $code = $mutator{$name} ) { |
169
|
20
|
|
|
|
|
70
|
$code->( $self, $name, $value ); |
170
|
|
|
|
|
|
|
} else { |
171
|
45
|
|
|
|
|
133
|
$self->SUPER::set( $name, $value ); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
} |
174
|
20
|
|
|
|
|
675
|
return $self; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
__END__ |