Class: NvectorSpherical

latlon-nvector-spherical~NvectorSpherical(x, y, z)

An n-vector is a (unit) vector normal to the Earth's surface (a non-singular position representation). For many applications, n-vectors are more convenient to work with than other position representations such as latitude/longitude, UTM coordinates, etc. On a spherical model earth, an n-vector is equivalent to a (normalised) earth-centred earth-fixed (ECEF) vector.

Constructor

new NvectorSpherical(x, y, z)

Creates a 3d n-vector normal to the Earth’s surface.
Parameters:
Name Type Description
x number X component of n-vector (towards 0°N, 0°E).
y number Y component of n-vector (towards 0°N, 90°E).
z number Z component of n-vector (towards 90°N).
Source:
Example
import { Nvector } from '/js/geodesy/latlon-nvector-spherical.js';
  const n = new Nvector(0.5000, 0.5000, 0.7071);

Extends

  • Vector3d

Methods

toLatLon() → {LatLon}

Converts ‘this’ n-vector to latitude/longitude point.
Source:
Returns:
Latitude/longitude point vector points to.
Type
LatLon
Example
const n = new Nvector(0.5000, 0.5000, 0.7071);
  const p = n.toLatLon(); // 45.0°N, 045.0°E

toString(dpopt) → {string}

Returns a string representation of ‘this’ n-vector.
Parameters:
Name Type Attributes Default Description
dp number <optional>
3 Number of decimal places to display.
Source:
Returns:
Comma-separated x, y, z, h values.
Type
string
Example
const v = new Nvector(0.5000, 0.5000, 0.7071).toString(); // [0.500,0.500,0.707]