line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GIS::Distance::Cosine; |
2
|
1
|
|
|
1
|
|
15
|
use 5.008001; |
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
4
|
use strictures 2; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
29
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
148
|
use parent 'GIS::Distance::Formula'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
52
|
use Math::Trig qw( deg2rad acos ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
54
|
|
9
|
1
|
|
|
1
|
|
6
|
use GIS::Distance::Constants qw( :all ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
89
|
|
10
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _distance { |
13
|
5
|
|
|
5
|
|
9
|
my ($lat1, $lon1, $lat2, $lon2) = @_; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
23
|
$lon1 = deg2rad($lon1); |
16
|
5
|
|
|
|
|
42
|
$lat1 = deg2rad($lat1); |
17
|
5
|
|
|
|
|
27
|
$lon2 = deg2rad($lon2); |
18
|
5
|
|
|
|
|
29
|
$lat2 = deg2rad($lat2); |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
28
|
my $a = sin($lat1) * sin($lat2); |
21
|
5
|
|
|
|
|
13
|
my $b = cos($lat1) * cos($lat2) * cos($lon2 - $lon1); |
22
|
5
|
|
|
|
|
12
|
my $c = acos($a + $b); |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
35
|
return $KILOMETER_RHO * $c; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |