Game Development Reference
In-Depth Information
solution that requires no iteration was developed by Stephen Bancroft. It is detailed in
his paper “An Algebraic Solution of the GPS Equations” in the IEEE Transactions on
Aerospace and Electronics Systems journal.
Besides clock errors, other errors are introduced by the atmosphere, signals bouncing
off the ground and back to the receiver, relativistic effects (discussed in Chapter 2 ), and
atomic clock drift. These are all accounted for in mathematical models applied to the
raw position data. For instance, the GPS clocks lose about 7,214 nanoseconds every day
due to their velocity according to special relativity. However, because they are higher
up in the earth's gravity well, they gain 45,850 nanoseconds every day according to
general relativity. The net effect is found by adding these values together: they run 38,640
nanoseconds faster each day, which would cause about 10 kilometers inaccuracy to build
each day they are in orbit. To account for this, the clocks in the GPS receivers are pre-
adjusted from 10.23 MHz to 10.22999999543 MHz. The fact that we are giving you a
number to 11 decimal places demonstrates the amount of accuracy the modern age
enjoys in its time keeping.
Once the bias is taken care of and all the other possible errors adjusted for, the converged
solution can be translated back into whatever coordinate system is convenient to give
to the end user. Usually this is latitude, longitude, and altitude. Next, we will learn how
to calculate different quantities based in the geographic coordinate system.
Location, Location, Location
Let's take a minute to discuss distance between two latitude and longitude coordinates.
You might be tempted to calculate it as the distance between two points. For very small
distances, this approximation is probably accurate enough. However, because the earth
is actually a sphere, over great distances the calculated route will be much shorter than
the actual distance along the surface.
The shortest distance between two points on a sphere, especially in problems of navi‐
gation, is called a great circle . A great circle is the intersection of a sphere and a plane
defined by the center point of the sphere, the origin, and the destination. The resulting
course actually has a heading that constantly changes. On ships, this is avoided in favor
of using a rhumb line , which is the shortest path of constant heading. This makes nav‐
igation easier at the expense of time. Airplanes, however, do follow great-circle routes
to minimize fuel burn.
Distance
There are several ways of calculating the distance along a great circle. The one we will
discuss here is the haversine formula . There are other methods like the spherical law of
cosines and the Vincenty formula , but the haversine is more accurate for small distances