1
0
Fork 0
flightgear/Docs/Scenery/CoordinateSystem/CoordinateSystem.tex
1999-04-05 21:32:32 +00:00

173 lines
5.7 KiB
TeX

%
% `coord.tex' -- describes the coordinate systems and transforms used
% by the FG scenery management subsystem
%
% Written by Curtis Olson. Started July, 1997.
%
% $Id$
\documentclass[12pt]{article}
% \usepackage{times}
% \usepackage{mathptm}
\usepackage{anysize}
\papersize{11in}{8.5in}
\marginsize{1in}{1in}{1in}{1in}
\usepackage{epsfig}
\usepackage{setspace}
\onehalfspacing
\usepackage{url}
\begin{document}
\title{
Flight Gear Internal Scenery Coordinate Systems and
Representations.
}
\author{
Curtis L. Olson\\
(\texttt{curt@me.umn.edu})
}
\maketitle
\section{Coordinate Systems}
\subsection{Geocentric Coordinates}
Geocentric coordinates are the polar coordinates centered at the
center of the earth. Points are defined by the geocentric longitude,
geocentric latitude, and distance from the \textit{center} of the
earth. Note, due to the non-spherical nature of the earth, the
geocentric latitude is not exactly the same as the traditional
latitude you would see on a map.
\subsection{Geodetic Coordinates}
Geodetic coordinates are represented by longitude, latitude, and
elevation above sea level. These are the coordinates you would read
off a map, or see on your GPS. However, the geodetic latitude does
not precisely correspond to the angle (in polar coordinates) from the
center of the earth which the geocentric coordinate system reports.
\subsection{Geocentric vs. Geodetic coordinates}
The difference between geodetic and geocentric coordinates is subtle
and must be understood. The problem arose because people started
mapping the earth using latitude and longitude back when they thought
the Earth was round (or a perfect sphere.) It's not though. It is
more of an ellipse.
Early map makers defined the standard \textit{geodetic} latitude as
the angle between the local up vector and the equator. This is shown
in figure \ref{fig:geodesy}. The point $\mathbf{B}$ marks our current
position. The line $\mathbf{ABC}$ is tangent to the ellipse at point
$\mathbf{B}$ and represents the local ``horizontal.'' The line
$\mathbf{BF}$ represents the local ``up'' vector. Thus, in
traditional map maker terms, the current latitude is the angle defined
by $\angle \mathbf{DBF}$.
However, as you can see from the figure, the line $\mathbf{BF}$ does
not extend through the center of the earth. Instead, the line
$\mathbf{BE}$ extends through the center of the earth. So in
\textit{geocentric} coordinates, our latitude would be reported as the
angle $\angle \mathbf{DBE}$.
\begin{figure}[hbt]
\centerline{
\psfig{file=geodesy.eps}
}
\caption{Geocentric vs. Geodetic coordinates}
\label{fig:geodesy}
\end{figure}
The LaRCsim flight model operates in geocentric coordinates
internally, but reports the current position in both coordinate
systems.
\subsection{World Geodetic System 1984 (WGS 84)}
The world is not a perfect sphere. WGS-84 defines a standard model
for dealing with this. The LaRCsim flight model code already uses the
WGS-84 standard in its calculations.
For those that are interested here are a couple of URLS for more
information:
\noindent
\url{http://acro.harvard.edu/SSA/BGA/wg84figs.html} \\
\url{http://www.afmc.wpafb.af.mil/organizations/HQ-AFMC/IN/mist/dma/wgs1984.htm}
\\
\url{http://www.nima.mil/publications/guides/dtf/datums.html}
To maintain simulation accuracy, the WGS-84 model should be used when
translating geodetic coordinates (via geocentric coordinates) into the
FG Cartesian coordinate system. The code to do this can probably be
borrowed from the LaRCsim code. It is located in
\texttt{ls\_geodesy.c}.
\subsection{Cartesian Coordinates}
Internally, all flight gear scenery is represented using a Cartesian
coordinate system. The origin of this coordinate system is the center
of the earth. The X axis runs along a line from the center of the
earth out to the equator at the zero meridian. The Z axis runs along
a line between the north and south poles with north being positive.
The Y axis is parallel to a line running through the center of the
earth out through the equator somewhere in the Indian Ocean. Figure
\ref{fig:coords} shows the orientation of the X, Y, and Z axes in
relationship to the earth.
\begin{figure}[hbt]
\centerline{
\psfig{file=coord.eps}
}
\caption{Flight Gear Coordinate System}
\label{fig:coords}
\end{figure}
\newpage
\subsection{Converting between coordinate systems}
Different aspects of the simulation will need to deal with positions
represented in the various coordinate systems. Typically map data is
presented in the geodetic coordinate system. The LaRCsim code uses
the geocentric coordinate system. FG will use a Cartesian coordinate
system for representing scenery internally. Potential add on items
such as GPS's will need to know positions in the geodetic coordinate
system, etc.
FG will need to be able to convert positions between any of these
coordinate systems. LaRCsim comes with code to convert back and forth
between geodetic and geocentric coordinates. So, we only need to
convert between geocentric and cartesian coordinates to complete the
picture. Converting from geocentric to cartesian coordinates is done
by using the following formula:
\noindent
\[ x = cos(lon_\mathit{geocentric}) * cos(lat_\mathit{geocentric}) *
radius_\mathit{geocentric} \]
\[ y = sin(lon_\mathit{geocentric}) * cos(lat_\mathit{geocentric}) *
radius_\mathit{geocentric} \]
\[ z = sin(lat_\mathit{geocentric}) * radius_\mathit{geocentric} \]
Here is the formula to convert from cartesian coordinates back into
geocentric coordinates:
\noindent
\[ lon = atan2( y, x ) \]
\[ lat = \frac{\pi}{2} - atan2( \sqrt{x*x + y*y}, z ) \]
\[ radius = \sqrt{x*x + y*y + z*z} \]
\end{document}