X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXBearing.pm;h=db6f4686d0a75ed89c32e0c32e28509ae233bb5a;hb=refs%2Fheads%2Fstaging;hp=e0e9910f95ca4cb89832e15f8976f9f139d04b83;hpb=5c28db7748418cce9d2ee1dce2cbb332cc21e3ab;p=spider.git diff --git a/perl/DXBearing.pm b/perl/DXBearing.pm index e0e9910f..db6f4686 100644 --- a/perl/DXBearing.pm +++ b/perl/DXBearing.pm @@ -8,25 +8,19 @@ # # Copyright (c) 1998 - Dirk Koopman G1TLH # -# $Id$ +# # package DXBearing; -use POSIX; use DXUtil; +use POSIX qw(:math_h); use strict; use vars qw($pi); $pi = 3.14159265358979; -use vars qw($VERSION $BRANCH); -$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); -$main::build += $VERSION; -$main::branch += $BRANCH; - # convert a qra locator into lat/long in DEGREES sub qratoll { @@ -107,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 {