diff --git a/CoordinateSystem/CoordinateSystem.tex b/CoordinateSystem/CoordinateSystem.tex new file mode 100644 index 000000000..29ec5b173 --- /dev/null +++ b/CoordinateSystem/CoordinateSystem.tex @@ -0,0 +1,246 @@ +% +% `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: \\ +$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}$ + +So far I haven't needed to convert from the cartesian coordinate +system back into any of the polar representations so I haven't derived +that part yet. However, it should be pretty straightforward. + + +\section{Scenery Representation} + +This section is a work in progress. I am hashing out ideas as I +write, so please feel free to send me your comments and suggestions. + +\subsection{External Scenery Representation} + +This section should deal with the external file format(s) that FG can +use for input. + +\subsection{Internal Scenery Representation} + +This section describes how FG represents, manipulates, and +transforms scenery internally. + +Internal, all FG scenery is defined using the coordinate system shown +in figure \ref{fig:coords}. This means that regardless of the +external scenery representation, FG will convert all object to it's +internal coordinate system when it loads the external file. Note, +when a default external FG scenery representation is created, its +representation should probably parallel the internal FG representation +as close as possible. This way, most necessary conversions can then +be done offline in advance. + +\subsection{Scenery Partitioning} + +For a first stab, scenery will be partitioned along longitude and +latitude lines. This will form trapezium shaped chunks. I'd like to +shoot for 10km x 10km chunks. So, as we move towards the poles, the +width in degrees of these areas will have to increase. Figure +\ref{fig:trap} shows an exaggerated scenery area. + +\begin{figure}[hbt] + \centerline{ + \psfig{file=trap.eps} + } + \caption{Scenery Partitioning Scheme} + \label{fig:trap} +\end{figure} + +\subsection{Reference Points} + +Each scenery area will have a reference point at the center of its +area. This reference point (for purposes of avoiding floating point +precision problems) defines the origin of a local coordinate system +which is oriented the same as the global coordinate system. The only +difference is the origin is translated from the center of the earth to +the center of the individual areas. Figure \ref{fig:reference} +demonstrates this. + +\begin{figure}[hbt] + \centerline{ + \psfig{file=ref.eps} + } + \caption{Reference Points and Translations} + \label{fig:reference} +\end{figure} + +All the objects for a specific scenery area will be defined based on +this local coordinate system. For each scenery area we define a +vector $\vec{\mathbf{a}}$ which represents the distance from the +center of the earth to the local coordinate system. + + +\subsection{Putting the pieces of scenery together} + +To render a scene, the scenery manager will need to load all the +nearby areas. Also, we define a vector $\vec{\mathbf{v}}$ which +represents the distance from the center of the earth to the current +view point. Before rendering each scenery area we translate it by +$\vec{\mathbf{a}} - \vec{\mathbf{v}}$. This moves all the current +scenery areas near the origin, while maintaining the relative +positions and orientations. All these transformations are inexpensive +to calculate and can be done easily with standard OpenGL calls. + +It is straightforward to calculate the proper view point and up vector +so that the scenery will appear right side up when it is rendered. + + + +\end{document} + diff --git a/CoordinateSystem/coord.fig b/CoordinateSystem/coord.fig new file mode 100644 index 000000000..7c33baab4 --- /dev/null +++ b/CoordinateSystem/coord.fig @@ -0,0 +1,25 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +0 +1200 2 +5 1 0 1 0 7 0 0 -1 0.000 0 1 0 0 6000.000 2700.000 4200 5100 6000 5700 7800 5100 +5 1 1 1 0 7 0 0 -1 4.000 0 0 0 0 6000.000 7500.000 4200 5100 6000 4500 7800 5100 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 6000 5100 1814 1814 6000 5100 7575 6000 +2 1 0 2 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 2.00 120.00 240.00 + 6000 5100 8400 5100 +2 1 0 2 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 2.00 120.00 240.00 + 6000 5100 6000 2700 +2 1 0 2 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 2.00 120.00 240.00 + 6000 5100 6900 4200 +4 0 0 0 0 0 14 0.0000 4 195 1245 5925 2550 Z (North Pole)\001 +4 0 0 0 0 0 14 0.0000 4 195 1485 6975 4125 Y (Indian Ocean)\001 +4 0 0 0 0 0 14 0.0000 4 150 150 8550 5175 X\001 +4 0 0 0 0 0 14 0.0000 4 195 2025 6750 5475 (Zero Meridian, Africa)\001 diff --git a/CoordinateSystem/geodesy.fig b/CoordinateSystem/geodesy.fig new file mode 100644 index 000000000..d70a5cb51 --- /dev/null +++ b/CoordinateSystem/geodesy.fig @@ -0,0 +1,43 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +0 +1200 2 +1 3 2 1 0 7 0 0 -1 3.000 1 0.0000 6300 4800 1800 1800 6300 4800 8100 4800 +1 1 0 2 0 7 0 0 -1 0.000 1 0.0000 6300 4800 2025 1500 6300 4800 8325 3300 +1 3 0 1 0 0 0 0 20 0.000 1 0.0000 6300 4800 44 44 6300 4800 6344 4795 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 7500 3600 8400 2700 +2 1 1 1 0 7 0 0 -1 4.000 0 0 -1 0 0 2 + 6300 4800 7500 3600 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 7500 3600 8700 3600 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 7500 3600 8100 2400 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 1 2 + 2 1 1.00 60.00 120.00 + 2 1 1.00 60.00 120.00 + 8700 4200 6000 2850 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 5625 4125 5400 3225 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6000 5475 6300 6300 +2 1 1 1 0 7 0 0 -1 4.000 0 0 -1 0 0 2 + 7500 3600 6750 5100 +4 0 0 0 0 0 14 0.0000 4 150 165 8550 4425 A\001 +4 0 0 0 0 0 14 0.0000 4 150 150 5775 2925 C\001 +4 0 0 0 0 0 14 0.0000 4 150 150 8550 3825 D\001 +4 0 0 0 0 0 14 0.0000 4 150 135 8325 3075 E\001 +4 0 0 0 0 0 14 0.0000 4 150 120 7800 2625 F\001 +4 0 0 0 0 0 12 0.0000 4 180 1125 5100 4350 Perfect Sphere\001 +4 0 0 0 0 0 12 0.0000 4 180 1980 5100 5400 True Earth ellipsoid shape\001 +4 0 0 0 0 0 14 0.0000 4 150 135 7500 3900 B\001 diff --git a/CoordinateSystem/old-coord.fig b/CoordinateSystem/old-coord.fig new file mode 100644 index 000000000..8de4472ce --- /dev/null +++ b/CoordinateSystem/old-coord.fig @@ -0,0 +1,27 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +0 +1200 2 +5 1 0 1 0 7 0 0 -1 0.000 0 1 0 0 8962.500 6000.000 3600 5100 3525 6000 3600 6900 +5 1 0 1 0 7 0 0 -1 0.000 0 1 0 0 10762.500 6000.000 5400 5100 5325 6000 5400 6900 +5 1 0 1 0 7 0 0 -1 0.000 0 1 0 0 4500.000 -262.500 3600 5100 4500 5175 5400 5100 +5 1 0 1 0 7 0 0 -1 0.000 0 0 0 0 4500.000 1537.500 5400 6900 4500 6975 3600 6900 +5 1 2 1 0 7 0 0 -1 3.000 0 1 0 0 9825.000 6075.000 4500 5175 4425 6000 4500 6975 +5 1 2 1 0 7 0 0 -1 3.000 0 0 0 0 4425.000 637.500 5325 6000 4425 6075 3525 6000 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6000 5175 4425 6075 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6000 5175 8550 5175 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6000 5175 6000 2625 +4 0 0 0 0 0 18 0.0000 4 195 180 8475 5475 X\001 +4 0 0 0 0 0 18 0.0000 4 195 180 5700 2700 Y\001 +4 0 0 0 0 0 18 0.0000 4 195 180 4500 5850 Z\001 diff --git a/CoordinateSystem/ref.fig b/CoordinateSystem/ref.fig new file mode 100644 index 000000000..cc347e286 --- /dev/null +++ b/CoordinateSystem/ref.fig @@ -0,0 +1,47 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +0 +1200 2 +5 1 0 1 0 7 0 0 -1 0.000 0 1 0 0 6900.000 3304.688 5100 5700 6975 6300 8700 5700 +5 1 1 1 0 7 0 0 -1 4.000 0 0 0 0 6900.000 8100.000 5100 5700 6900 5100 8700 5700 +5 1 0 1 0 7 0 0 -1 4.000 0 0 0 0 6900.000 5175.000 5925 5100 6075 4650 6375 4350 +5 1 0 1 0 7 0 0 -1 4.000 0 0 0 0 8887.500 5062.500 6600 5325 6600 4800 6675 4425 +5 1 0 1 0 7 0 0 -1 4.000 0 1 0 0 6675.000 3975.000 5925 5100 6225 5250 6600 5325 +5 1 0 1 0 7 0 0 -1 4.000 0 1 0 0 6600.000 4087.500 6375 4350 6525 4425 6675 4425 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 6900 5700 1802 1802 6900 5700 8700 5775 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6300 4800 6300 3600 +2 1 0 2 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 2.00 120.00 240.00 + 6900 5700 9300 5700 +2 1 0 2 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 2.00 120.00 240.00 + 6900 5700 7800 4800 +2 1 0 2 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 2.00 120.00 240.00 + 6900 5700 6900 3300 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6300 4800 7200 4800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 2 1 1.00 60.00 120.00 + 6300 4800 6750 4350 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 6900 5700 6300 4800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 1 0 2 + 0 0 1.00 60.00 120.00 + 6075 4950 6300 4950 +4 0 0 0 0 0 14 0.0000 4 150 120 6825 3150 Z\001 +4 0 0 0 0 0 14 0.0000 4 150 135 7875 4800 Y\001 +4 0 0 0 0 0 14 0.0000 4 150 150 9450 5775 X\001 +4 0 0 0 0 0 12 0.0000 4 135 135 7275 4875 X\001 +4 0 0 0 0 0 12 0.0000 4 135 135 6675 4275 Y\001 +4 0 0 0 0 0 12 0.0000 4 135 120 6300 3525 Z\001 +4 0 0 0 0 0 12 0.0000 4 90 90 6150 5100 a\001 diff --git a/CoordinateSystem/trap.fig b/CoordinateSystem/trap.fig new file mode 100644 index 000000000..546c94a80 --- /dev/null +++ b/CoordinateSystem/trap.fig @@ -0,0 +1,16 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +0 +1200 2 +5 1 0 1 0 7 0 0 -1 0.000 0 1 0 0 6900.000 3304.688 5100 5700 6975 6300 8700 5700 +5 1 1 1 0 7 0 0 -1 4.000 0 0 0 0 6900.000 8100.000 5100 5700 6900 5100 8700 5700 +5 1 0 1 0 7 0 0 -1 4.000 0 0 0 0 6900.000 5175.000 5925 5100 6075 4650 6375 4350 +5 1 0 1 0 7 0 0 -1 4.000 0 0 0 0 8887.500 5062.500 6600 5325 6600 4800 6675 4425 +5 1 0 1 0 7 0 0 -1 4.000 0 1 0 0 6675.000 3975.000 5925 5100 6225 5250 6600 5325 +5 1 0 1 0 7 0 0 -1 4.000 0 1 0 0 6600.000 4087.500 6375 4350 6525 4425 6675 4425 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 6900 5700 1802 1802 6900 5700 8700 5775