n-vector downloads
Functions for performing various position calculations are available for download here. The functions are available in Matlab, C#, C++, Python, JavaScript, and other languages.
Matlab
The following 19 files are available for download at GitHub:
Convert between lat/long and n-vector:
-
lat_long2n_E.m
Converts latitude and longitude to n-vector n_E2lat_long.m
Converts n-vector to latitude and longitude
Convert between delta (i.e. local position vector) and n-vectors:
n_EA_E_and_n_EB_E2p_AB_E.m
From two positions A and B, finds the delta positionn_EA_E_and_p_AB_E2n_EB_E.m
From position A and delta, finds position B
Convert between n-vector and ECEF-vector (i.e. position vector from Earth center, in meters):
n_EB_E2p_EB_E.m
Converts n-vector to ECEF-vectorp_EB_E2n_EB_E.m
Converts ECEF-vector to n-vector
Convert between n-vector and rotation matrix:
R_EN2n_E.m
Finds n-vector fromn_E2R_EN.m
FindsR E N MathType@MTEF@5@5@+=feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiFv0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabmqaamaabaabaaGcbaGaaCOuamaaDaaaleaacaWGfbGaamOtaaqaaaaaaaa@38CA@ R_EL2n_E.m
Finds n-vector fromR E L MathType@MTEF@5@5@+=feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiFv0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabmqaamaabaabaaGcbaGaaCOuamaaDaaaleaacaWGfbGaamitaaqaaaaaaaa@38C8@ n_E_and_wa2R_EL.m
FindsR E L MathType@MTEF@5@5@+=feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiFv0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabmqaamaabaabaaGcbaGaaCOuamaaDaaaleaacaWGfbGaamitaaqaaaaaaaa@38C8@
Convert between Euler angles and rotation matrix:
xyz2R.m
Creates a rotation matrix from three angles about new axes in the xyz orderR2xyz.m
Three angles about new axes in the xyz order are found from a rotation matrixzyx2R
Creates a rotation matrix from three angles about new axes in the zyx order (e.g. yaw-pitch-roll)R2zyx.m
Three angles about new axes in the zyx order (e.g. yaw-pitch-roll) are found from a rotation matrix
Miscellaneous simple utilities:
unit.m
Makes input vector unit length (i.e. norm=1)rad.m
Converts angle in degrees to radiansdeg.m
Converts angle in radians to degreesR_Ee.m
Selects axes of the coordinate frame E
Solutions to the ten examples:
examples.m
Solutions to the ten examples.
C# (C Sharp)
C#-version of the n-vector library and the 10 examples.
Author: Jørn Inge Vestgården at FFI (responsible for translation from Matlab and adaption to C#).
C++
C++-version of the n-vector library. (Currently, the first 8 functions in the list above are included).
Author: Magnus Baksaas at FFI (responsible for translation from Matlab and adaption to C++).
Python
A Python-version of the entire n-vector library is available at GitHub. Python solutions to the 10 examples are also included there.
Author: Per A. Brodtkorb at FFI (responsible for translation from Matlab and adaption to Python).
JavaScript
For JavaScript, a version of the n-vector library is available, and also solutions to the 10 examples. See also GitHub.
Author: Chris Veness at Movable Type (responsible for translation from Matlab and adaption to JavaScript).
Haskell
A Haskell-version of the n-vector library is available at GitHub.
Author: Cedric Liegeois at Thales (responsible for translation from Matlab and adaption to Haskell).
R
For R, a version of the n-vector library is available, and also solutions to the 10 examples. See also GitHub.
Author: Enrico Spinielli at EUROCONTROL (responsible for translation from Matlab and adaption to R).
Java, LabVIEW etc.
If you translate the functions to another programming language, and want to make your solution available for others, we would be happy to add your files (with credits) to this site (or add a link to a site where the functions are available).