n-vector explained
This page gives a brief introduction to n-vector.
What is n-vector?
n-vector is just the 3D normal vector to the Earth ellipsoid (or sphere, if spherical Earth model is used). It can replace latitude and longitude (and other alternatives) to represent horizontal position, giving several advantages. This page gives a brief introduction, see Gade (2010) for a more detailed explanation.
Why is n-vector needed?
Performing global position calculations often involves one or more of the following concerns:
1. Complex implementations (many, and often complex lines of program code needed)
2. Approximations, e.g.
a. distortion in map projections
b. assuming spherical Earth when ellipsoidal should be used
Errors often increase with increasing distances
3. Equation/code not valid/accurate for all Earth positions, e.g.
a. Latitude/longitude:
i. Singularities at Poles
ii. Discontinuity at International Date Line (±180° meridian)
b. Map projections: usually valid for a limited area, e.g. UTM
4. Iterations (need to iterate to achieve needed accuracy)
By using n-vector and the solutions provided here, these concerns can be avoided for a majority of position calculations.
What can go wrong if using latitude and longitude?
Even the simple discontinuity of longitude at the International Date Line (±180° meridian) can give serious consequences if not handled correctly in all the code. An example illustrating this was the computer crash experienced by 12 fighter aircrafts (F-22 Raptors) when they crossed this meridian in 2007.
The discontinuity can be quite easily handled by adding specific code, while the singularities at the Poles are much more challenging to deal with. Examples of how the singularities can affect calculations with latitude and longitude are found in Section 6 in Gade (2010).
n-vector
As discussed above, using latitude and longitude in calculations may lead to several problems due to the singularities at the Poles and complex behavior near the Poles, and due to the discontinuity at the Date Line (±180° meridian).
Instead of latitude and longitude, we represent position with an “n-vector”, which is the normal vector to the Earth model (the same reference ellipsoid that is used for latitude and longitude). When using n-vector, all Earth-positions are treated equally, and there is no need to worry about singularities or discontinuities. An additional benefit with using n-vector is that many position calculations can be solved with simple vector algebra (e.g. dot product and cross product).
n_E.
E denotes an Earth-fixed coordinate frame, and it indicates that the three components of n-vector are along the three axes of E. More details about the notation used are found here. The position of the North Pole given as n-vector isConverting between n-vector and lat/long
lat_long2n_E
and n_E2lat_long
are used for these conversions.Many position calculations can be solved with only two functions
It turns out that very often, the problem to be solved is one of these:
- A and B => delta: Given two positions, A and B (e.g. as latitudes/longitudes/heights), find the (delta) vector from A to B in meters. See also Example 1.
- A and delta => B: Given position A (e.g. as lat/long/height) and a vector in meters from A to B, find position B. See also Example 2.
n_EA_E
and n_EB_E
. The (delta) position vector from A to B is written p_AB_E
). More information about the notation is found here. n_EA_E_and_n_EB_E2p_AB_E
n_EA_E_and_p_AB_E2n_EB_E
By default, these functions use the WGS-84 ellipsoid, but any custom ellipsoid (or sphere) may be specified.