| 1 | package GIS::Distance::MathTrig; | ||
| 2 | 1 | ▶ | use 5.008001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use strictures 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | our $VERSION = '0.18'; | |
| 5 | |||
| 6 | 1 | ▶ | use parent 'GIS::Distance::Formula'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | use Math::Trig qw( great_circle_distance deg2rad ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use GIS::Distance::Constants qw( :all ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | sub _distance { | ||
| 13 | 5 | ▶ | my ($lat1, $lon1, $lat2, $lon2) = @_; |
|
Subroutine
_distance: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 5 | return great_circle_distance( | |
| 16 | deg2rad($lon1), | ||
| 17 | deg2rad(90 - $lat1), | ||
| 18 | deg2rad($lon2), | ||
| 19 | deg2rad(90 - $lat2), | ||
| 20 | $KILOMETER_RHO, | ||
| 21 | ); | ||
| 22 | } | ||
| 23 | |||
| 24 | 1 | 1; | |
| 25 | __END__ | ||