kopia lustrzana https://github.com/Hamlib/Hamlib
Correction of short path azimuth calculation by Dave Freese, W1HKJ
in the qrb function. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2536 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.9
rodzic
41aa9c8dda
commit
a2ffaf04dd
|
@ -18,7 +18,7 @@
|
||||||
* Copyright (c) 2003 by Nate Bargmann
|
* Copyright (c) 2003 by Nate Bargmann
|
||||||
* Copyright (c) 2003 by Dave Hines
|
* Copyright (c) 2003 by Dave Hines
|
||||||
*
|
*
|
||||||
* $Id: locator.c,v 1.19 2006-10-15 00:27:51 aa6e Exp $
|
* $Id: locator.c,v 1.20 2008-12-29 13:12:29 n0nb Exp $
|
||||||
*
|
*
|
||||||
* Code to determine bearing and range was taken from the Great Circle,
|
* Code to determine bearing and range was taken from the Great Circle,
|
||||||
* by S. R. Sampson, N5OWK.
|
* by S. R. Sampson, N5OWK.
|
||||||
|
@ -539,29 +539,22 @@ int HAMLIB_API qrb(double lon1, double lat1, double lon2, double lat2, double *d
|
||||||
* This method is easier than the one in the handbook
|
* This method is easier than the one in the handbook
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Short Path */
|
|
||||||
*distance = ARC_IN_KM * RADIAN * arc;
|
*distance = ARC_IN_KM * RADIAN * arc;
|
||||||
|
|
||||||
/* This formula seems to work with very small distances
|
/* Short Path */
|
||||||
*
|
/* Change to azimuth computation by Dave Freese, W1HKJ */
|
||||||
* I found it on the Web at:
|
|
||||||
* http://williams.best.vwh.net/avform.htm#Crs
|
az = RADIAN * atan2(sin(lon2 - lon1) * cos(lat2),
|
||||||
*
|
(cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon2 - lon1)));
|
||||||
* Strangely, all the computed values were negative thus the
|
|
||||||
* sign reversal below.
|
az = fmod(360.0 + az, 360.0);
|
||||||
* - N0NB
|
if (az < 0.0)
|
||||||
*/
|
az += 360.0;
|
||||||
az = RADIAN * fmod(atan2(sin(lon1 - lon2) * cos(lat2),
|
else if (az >= 360.0)
|
||||||
cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1 - lon2)), 2 * M_PI);
|
az -= 360.0;
|
||||||
if (lon1 > lon2) {
|
|
||||||
az -= 360.;
|
*azimuth = floor(az + 0.5);
|
||||||
*azimuth = -az;
|
|
||||||
} else {
|
|
||||||
if (az >= 0.0)
|
|
||||||
*azimuth = az;
|
|
||||||
else
|
|
||||||
*azimuth = -az;
|
|
||||||
}
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue