Learn R Programming

nvctr

Overview

The nvctr package implements the n-vector approach to geographical position calculations using an ellipsoidal model of Earth as described in (Gade 2010).

Implementations in various computer languages can be found at the n-vector page (Navigation Group 2010).

Installation

You can install the development version of nvctr from GitHub with:

devtools::install_github("euctrl-pru/nvctr")

or the CRAN version (when this package will land to CRAN):

install.packages("nvctr")

Usage

nvctr can be used to solve geographical position calculation like (example numbers refer to the ones in the vignette):

  • Calculate the surface distance between two geographical positions (Example 5).
  • Find the destination point given start point, azimuth/bearing and distance (Example 8).
  • Find the mean position (center/midpoint) of several geographical positions (Example 6).
  • Find the intersection between two paths (Example 9).
  • Find the cross track distance between a path and a position (Example 10).

References

Gade, Kenneth. 2010. “A Non-Singular Horizontal Position Representation.” In Journal of Navigation, vol. 63. no. 3. https://doi.org/10.1017/S0373463309990415.

Navigation Group, FFI. 2010. The N-Vector Page. https://www.ffi.no/en/research/n-vector/.

Copy Link

Version

Install

install.packages('nvctr')

Monthly Downloads

127

Version

0.1.7

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Enrico Spinielli

Last Published

December 13th, 2025

Functions in nvctr (0.1.7)

%>%

Pipe operator
p_EB_E2n_EB_E

Convert cartesian position vector in meters to n-vector
n_EA_E_and_p_AB_E2n_EB_E

Find position B from position A and delta
unit

Make input vector unit length, i.e. norm == 1
n_EB_E2p_EB_E

Convert n-vector to cartesian position vector in meters
rad

Convert angle in degrees to radians.
zyx2R

Create a rotation matrix from 3 angles about new axes in the zyx order.
xyz2R

Create a rotation matrix from 3 angles about new axes in the xyz order.
R_EN2n_E

Find n-vector from R_E
deg

Convert angle in radians to degrees
R_Ee

Select the axes of the coordinate frame E
cross_track_intersection

Calculate cross-track intersection
altitude_azimuth_distance

Calculate the altitude, azimuth and distance of B from A
R2zyx

Find the three angles about new axes in the zyx order from a rotation matrix
cross_track_distance

Compute the cross-track distance from a great circle arc
along_track_distance

Compute the along-track distance from a great circle arc
R_EL2n_E

Find n-vector from the rotation matrix (direction cosine matrix) R_EL
R2xyz

Find the three rotation angles about new axes in the xyz order from a rotation matrix
n_E_and_wa2R_EL

Find R_EL from n-vector and wander azimuth angle
lat_lon2n_E

Convert (geodetic) latitude and longitude to n-vector
nvctr

nvctr: non-singular geographical position calculations
n_E2lat_lon

Convert n-vector to latitude and longitude
n_EA_E_and_n_EB_E2p_AB_E

Find the delta position from two positions A and B
n_E2R_EN

Find the rotation matrix R_EN from n-vector