Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Geodesy.cpp File Reference

Implements utility functions related to geodesic systems. More...

#include "../Include/FlyLegacy.h"
#include "../Include/Utility.h"
#include <plib/sg.h>

Go to the source code of this file.

Defines

#define PI_2   (SGD_PI * 2)
#define ARCSEC_360DEG   (360 * 3600)
#define ARCSEC_TO_RAD   (PI_2 / ARCSEC_360DEG)
#define ONE_ARCSEC   (ARCSEC_TO_RAD)
#define EQUATORIAL_RADIUS_FEET   (3963.19 * 5280)
#define EQUATORIAL_RADIUS_M   (EQUATORIAL_RADIUS_FEET * METRES_PER_FOOT)
#define EQ_RAD_SQUARE_M   (EQUATORIAL_RADIUS_M * EQUATORIAL_RADIUS_M)

Functions

void test_geodesy (void)
SPosition GeocToGeod (SPosition pos)
SPosition GeodToGeoc (SPosition pos)
SVector GeocToCartesian (SPosition pos)
void GeocToCartesianSgdVec3 (SPosition pos, sgdVec3 *v)
SPosition CartesianToGeoc (SVector v)
SVector GeodToCartesian (SPosition pos)
static double M0 (double e2)
static int geo_direct_wgs_84 (const double &alt, const double &lat1, const double &lon1, const double &az1, const double &s, double *lat2, double *lon2, double *az2)
SPosition GreatCirclePosition (SPosition *from, SVector *polar)
static int geo_inverse_wgs_84 (const double &alt, const double &lat1, const double &lon1, const double &lat2, const double &lon2, double *az1, double *az2, double *s)
SVector GreatCirclePolar (SPosition *from, SPosition *to)

Variables

static const double FP = 0.003352813178
static const double E = 0.996647186
static const double EPS = 0.081819221
static const double INVG = 0.031080997


Detailed Description

These routines transform geocentric coordinates to geodetic coordinates using the WGS84 coordinate system.

The code was taken from SimGear 0.3.3 module "sg_geodesy.cxx". Minor cosmetic changes made for Fly! Legacy project by Chris Wallace.

See end of file for original comments

Definition in file Geodesy.cpp.


Define Documentation

#define ARCSEC_360DEG   (360 * 3600)
 

Definition at line 80 of file Geodesy.cpp.

#define ARCSEC_TO_RAD   (PI_2 / ARCSEC_360DEG)
 

Definition at line 81 of file Geodesy.cpp.

Referenced by GeocToGeod(), and GeodToGeoc().

#define EQ_RAD_SQUARE_M   (EQUATORIAL_RADIUS_M * EQUATORIAL_RADIUS_M)
 

Definition at line 85 of file Geodesy.cpp.

Referenced by GeocToGeod(), and GeodToGeoc().

#define EQUATORIAL_RADIUS_FEET   (3963.19 * 5280)
 

Definition at line 83 of file Geodesy.cpp.

#define EQUATORIAL_RADIUS_M   (EQUATORIAL_RADIUS_FEET * METRES_PER_FOOT)
 

Definition at line 84 of file Geodesy.cpp.

Referenced by GeocToGeod().

#define ONE_ARCSEC   (ARCSEC_TO_RAD)
 

Definition at line 82 of file Geodesy.cpp.

Referenced by GeocToGeod().

#define PI_2   (SGD_PI * 2)
 

Definition at line 79 of file Geodesy.cpp.

Referenced by GeocToGeod().


Function Documentation

SPosition CartesianToGeoc SVector  v  ) 
 

Definition at line 236 of file Geodesy.cpp.

References SPosition::alt, SPosition::lat, SPosition::lon, PI, SVector::x, SVector::y, and SVector::z.

Referenced by test_geodesy().

static int geo_direct_wgs_84 const double &  alt,
const double &  lat1,
const double &  lon1,
const double &  az1,
const double &  s,
double *  lat2,
double *  lon2,
double *  az2
[static]
 

Definition at line 287 of file Geodesy.cpp.

References first, and M0().

Referenced by GreatCirclePosition().

static int geo_inverse_wgs_84 const double &  alt,
const double &  lat1,
const double &  lon1,
const double &  lat2,
const double &  lon2,
double *  az1,
double *  az2,
double *  s
[static]
 

Definition at line 407 of file Geodesy.cpp.

Referenced by GreatCirclePolar().

SVector GeocToCartesian SPosition  pos  ) 
 

Definition at line 209 of file Geodesy.cpp.

References SPosition::alt, SPosition::lat, SPosition::lon, SVector::x, SVector::y, and SVector::z.

Referenced by GeodToCartesian(), and test_geodesy().

void GeocToCartesianSgdVec3 SPosition  pos,
sgdVec3 *  v
 

Definition at line 223 of file Geodesy.cpp.

References SPosition::alt, SPosition::lat, and SPosition::lon.

SPosition GeocToGeod SPosition  pos  ) 
 

Definition at line 104 of file Geodesy.cpp.

References SPosition::alt, ARCSEC_TO_RAD, E, EPS, EQ_RAD_SQUARE_M, EQUATORIAL_RADIUS_M, FeetToMetres(), SPosition::lat, SPosition::lon, MetresToFeet(), ONE_ARCSEC, and PI_2.

Referenced by test_geodesy().

SVector GeodToCartesian SPosition  pos  ) 
 

Definition at line 252 of file Geodesy.cpp.

References GeocToCartesian(), and GeodToGeoc().

Referenced by CSkyManager::Update().

SPosition GeodToGeoc SPosition  pos  ) 
 

Definition at line 169 of file Geodesy.cpp.

References SPosition::alt, ARCSEC_TO_RAD, E, EQ_RAD_SQUARE_M, FeetToMetres(), SPosition::lat, SPosition::lon, and MetresToFeet().

Referenced by GeodToCartesian(), and test_geodesy().

SVector GreatCirclePolar SPosition from,
SPosition to
 

Definition at line 524 of file Geodesy.cpp.

References SPosition::alt, FeetToMetres(), geo_inverse_wgs_84(), SVector::h, SPosition::lat, SPosition::lon, MetresToFeet(), SVector::p, and SVector::r.

Referenced by CNavRadio::TimeSlice(), and CBKKX155Radio::TimeSlice().

SPosition GreatCirclePosition SPosition from,
SVector polar
 

Definition at line 376 of file Geodesy.cpp.

References SPosition::alt, FeetToMetres(), geo_direct_wgs_84(), SVector::h, SPosition::lat, SPosition::lon, and SVector::r.

static double M0 double  e2  )  [inline, static]
 

Definition at line 282 of file Geodesy.cpp.

Referenced by geo_direct_wgs_84().

void test_geodesy void   ) 
 

Definition at line 44 of file Geodesy.cpp.

References SPosition::alt, CartesianToGeoc(), FormatPosition(), GeocToCartesian(), GeocToGeod(), GeodToGeoc(), SPosition::lat, and SPosition::lon.


Variable Documentation

const double E = 0.996647186 [static]
 

Definition at line 95 of file Geodesy.cpp.

Referenced by CTerrainManager::Draw(), GeocToGeod(), GeodToGeoc(), CMoonImage::Reposition(), and CSkyManager::SetCamera().

const double EPS = 0.081819221 [static]
 

Definition at line 96 of file Geodesy.cpp.

Referenced by GeocToGeod().

const double FP = 0.003352813178 [static]
 

Definition at line 94 of file Geodesy.cpp.

const double INVG = 0.031080997 [static]
 

Definition at line 97 of file Geodesy.cpp.

SourceForge.net Logo Documentation generated by doxygen