RAVE
polar.c File Reference

Navigation routines for calculating distances and heights. More...

#include "polar.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "rave_alloc.h"
#include "rave_debug.h"

Functions

void resetPosStruct (Position *pos)
 Resets the position struct to have all values set to 0.
 
PositioncopyPosStruct (Position *src)
 Copies a position struct and returns an allocated instance with the same values.
 
double getEarthRadius (double lat0)
 Returns the earth radius at the specified latitude.
 
void llToDa (Position *src, Position *tgt)
 Latitude/Longitude to Distance/Azimuth.
 
void daToLl (Position *src, Position *tgt)
 Distance/Azimuth to Latitude/Longitude.
 
void dhToRe (Position *src, Position *tgt)
 Distance/Altitude to Range/Elevation.
 
void deToRh (Position *src, Position *tgt)
 Distance/Elevation to Range/Altitude.
 
void reToDh (Position *src, Position *tgt)
 Range/Elevation to Distance/Altitude.
 
void ehToRd (Position *src, Position *tgt)
 Elevation/Height to Range/Distance.
 

Variables

const double R_EQU = 6378160.0
 Radius at the equator.
 
const double R_POL = 6356780.0
 Radius to the poles.
 

Detailed Description

Navigation routines for calculating distances and heights.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
1998-

Function Documentation

◆ copyPosStruct()

Position * copyPosStruct ( Position * src)

Copies a position struct and returns an allocated instance with the same values.

Parameters
[in]srcthe struct to be copied
Returns
the position struct or NULL on failure

◆ daToLl()

void daToLl ( Position * src,
Position * tgt )

Distance/Azimuth to Latitude/Longitude.

Parameters
[in]srcthe position object, lon0, lat0, distance and azimuth should be specified
[in,out]tgtthe resulting position object, lon and lat will be set

◆ deToRh()

void deToRh ( Position * src,
Position * tgt )

Distance/Elevation to Range/Altitude.

Parameters
[in]srcthe position object, lat0, dndh, alt0, alt, distance and elevation should be specified
[in,out]tgtthe resulting position object, range, alt and momelev will be set

◆ dhToRe()

void dhToRe ( Position * src,
Position * tgt )

Distance/Altitude to Range/Elevation.

Parameters
[in]srcthe position object, lat0, dndh, alt, alt0, distance, elevation should be specified
[in,out]tgtthe resulting position object, range, elevation and momelev will be set

◆ ehToRd()

void ehToRd ( Position * src,
Position * tgt )

Elevation/Height to Range/Distance.

Parameters
[in]srcthe position object, lat0, dndh, alt, alt0 and elevation should be specified
[in,out]tgtthe resulting position object, range, distance and momelev will be set

◆ getEarthRadius()

double getEarthRadius ( double lat0)

Returns the earth radius at the specified latitude.

Parameters
[in]lat0the latitude in radians
Returns
the earth radius in meters

◆ llToDa()

void llToDa ( Position * src,
Position * tgt )

Latitude/Longitude to Distance/Azimuth.

Parameters
[in]srcthe position object, lon0, lat0, lon and lat should be specified
[in,out]tgtthe resulting position object, distanze and azimuth will be set.

◆ resetPosStruct()

void resetPosStruct ( Position * pos)

Resets the position struct to have all values set to 0.

Parameters
[in]posthe position struct

◆ reToDh()

void reToDh ( Position * src,
Position * tgt )

Range/Elevation to Distance/Altitude.

Parameters
[in]srcthe position object, lat0, dndh, alt0, range and elevation should be specified
[in,out]tgtthe resulting position object, alt, distance and momelev will be set

Variable Documentation

◆ R_EQU

const double R_EQU = 6378160.0

Radius at the equator.

◆ R_POL

const double R_POL = 6356780.0

Radius to the poles.