Main Page   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

locator.c File Reference

locator and bearing conversion interface More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <hamlib/rotator.h>

Functions

double dms2dec (int degrees, int minutes, int seconds)
 Convert DMS angle to decimal representation.

void dec2dms (double dec, int *degrees, int *minutes, int *seconds)
 Convert decimal angle into DMS representation.

int locator2longlat (double *longitude, double *latitude, const char *locator)
 Convert Maidenhead grid locator to longitude/latitude.

void longlat2locator (double longitude, double latitude, char *locator)
 Convert longitude/latitude to Maidenhead grid locator.

int qrb (double lon1, double lat1, double lon2, double lat2, double *distance, double *azimuth)
 Calculate the distance and bearing between two points.

double distance_long_path (double distance)
 Calculate the long path distance between two points.

double azimuth_long_path (double azimuth)
 Calculate the long path bearing between two points.


Detailed Description

locator and bearing conversion interface

Author:
Stephane Fillod
Date:
2000-2002
Hamlib interface is a frontend implementing wrapper functions.

Function Documentation

double azimuth_long_path double    azimuth
 

Calculate the long path bearing between two points.

Parameters:
azimuth The bearing
Calculate the long path (resp. short path) of a given bearing.

Returns:
the azimuth in decimal degrees for the opposite path.
See also:
qrb()

void dec2dms double    dec,
int *    degrees,
int *    minutes,
int *    seconds
 

Convert decimal angle into DMS representation.

Parameters:
dec Decimal angle
degrees The location where to store the degrees
minutes The location where to store the minutes
seconds The location where to store the seconds
Convert decimal angle into its degree/minute/second representation. Upon return dec2dms guarantees -180<=degrees<180, 0<=minutes<60, and 0<=seconds<60.

See also:
dms2dec()

double distance_long_path double    distance
 

Calculate the long path distance between two points.

Parameters:
distance The distance
Calculate the long path (resp. short path) of a given distance.

Returns:
the distance in kilometers for the opposite path.
See also:
qrb()

double dms2dec int    degrees,
int    minutes,
int    seconds
 

Convert DMS angle to decimal representation.

Parameters:
degrees Degrees
minutes Minutes
seconds Seconds
Convert degree/minute/second angle to a decimal representation. Degrees >360, minutes > 60, and seconds > 60 are allowed, but resulting angle won't be normalized.

Returns:
the decimal representation.
See also:
dec2dms()

int locator2longlat double *    longitude,
double *    latitude,
const char *    locator
 

Convert Maidenhead grid locator to longitude/latitude.

Parameters:
longitude The location where to store longitude, decimal
latitude The location where to store latitude, decimal
locator The locator
Convert Maidenhead grid locator to longitude/latitude (decimal). The locator be either in 4 or 6 chars long format. locator2longlat is case insensitive, however it checks for locator validity.

Todo:
: give center coordinate of locator
Returns:
0 to indicate conversion went ok, otherwise a negative value.
See also:
longlat2locator()

void longlat2locator double    longitude,
double    latitude,
char *    locator
 

Convert longitude/latitude to Maidenhead grid locator.

Parameters:
longitude The longitude, decimal
latitude The latitude, decimal
locator The location where to store the locator
Convert longitude/latitude (decimal) to Maidenhead grid locator. locator must point to an array at least 6 char long.

Todo:
: give center coordinate of locator
See also:
locator2longlat()

int qrb double    lon1,
double    lat1,
double    lon2,
double    lat2,
double *    distance,
double *    azimuth
 

Calculate the distance and bearing between two points.

Parameters:
lon1 The local longitude, decimal degrees
lat1 The local latitude, decimal degrees
lon2 The remote longitude, decimal degrees
lat2 The remote latitude, decimal degrees
distance The location where to store the distance
azimuth The location where to store the bearing
Calculate the QRB between lat1,lat1 and lon2,lat2. This version also takes into consideration the two points being close enough to be in the near-field, and the antipodal points, which are easily calculated.

Returns:
the distance in kilometers and azimuth in decimal degrees for the short path.
See also:
distance_long_path(), azimuth_long_path()


Generated on Mon May 26 17:46:56 2003 for Hamlib - the C library reference by doxygen1.3-rc3