X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXBearing.pm;h=db6f4686d0a75ed89c32e0c32e28509ae233bb5a;hb=8106275008346b0cceb090f7317ff4240a3ba44f;hp=b98d746a5b5c88d4e2df409068ad43dd312aae2b;hpb=e2ca7811e49048bfad82ec31e148a79fe9904e2b;p=spider.git diff --git a/perl/DXBearing.pm b/perl/DXBearing.pm index b98d746a..db6f4686 100644 --- a/perl/DXBearing.pm +++ b/perl/DXBearing.pm @@ -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 {