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