X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXBearing.pm;h=db6f4686d0a75ed89c32e0c32e28509ae233bb5a;hb=8106275008346b0cceb090f7317ff4240a3ba44f;hp=637a6aa889642b33d3a04c3b62656312b3f9e4c2;hpb=b9dffeff7239952814342dad19db3a51def6fab7;p=spider.git diff --git a/perl/DXBearing.pm b/perl/DXBearing.pm index 637a6aa8..db6f4686 100644 --- a/perl/DXBearing.pm +++ b/perl/DXBearing.pm @@ -8,7 +8,7 @@ # # Copyright (c) 1998 - Dirk Koopman G1TLH # -# $Id$ +# # package DXBearing; @@ -101,6 +101,20 @@ sub bdist return (rd($az), $dx); } +# just the distance - parameters as above +sub distance +{ + my $hn = dr(shift); + my $he = dr(shift); + my $n = dr(shift); + my $e = dr(shift); + return (0, 0) if $hn == $n && $he == $e; + my $co = cos($he-$e)*cos($hn)*cos($n)+sin($hn)*sin($n); + my $ca = $co ? atan(abs(sqrt(1-$co*$co)/$co)) : $pi; + $ca = $pi-$ca if $co < 0; + my $dx = 6367*$ca; +} + # turn a lat long string into floating point lat and long sub stoll {