# Class: NvectorEllipsoidal

## latlon-nvector-ellipsoidal~NvectorEllipsoidal(x, y, z, hopt, datumopt)

An n-vector is a position representation using a (unit) vector normal to the Earth ellipsoid. Unlike latitude/longitude points, n-vectors have no singularities or discontinuities. For many applications, n-vectors are more convenient to work with than other position representations such as latitude/longitude, earth-centred earth-fixed (ECEF) vectors, UTM coordinates, etc.

## Constructor

#### new NvectorEllipsoidal(x, y, z, hopt, datumopt)

Creates a 3d n-vector normal to the Earth's surface.
##### Parameters:
Name Type Attributes Default 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).
h number <optional>
0 Height above ellipsoid surface in metres.
datum LatLon.datums <optional>
WGS84 Datum this n-vector is defined within.
Source:

• Vector3d

### Methods

#### toCartesian() → {Cartesian}

Converts ‘this’ n-vector to cartesian coordinate. qv Gade 2010 ‘A Non-singular Horizontal Position Representation’ eqn 22
Source:
##### Returns:
Cartesian coordinate equivalent to this n-vector.
Type
Cartesian
##### Example
const c = new Nvector(0.500000, 0.500000, 0.707107).toCartesian(); // [3194419,3194419,4487349]
const p = c.toLatLon();                                            // 45.0000°N, 045.0000°E

#### toLatLon() → {LatLon}

Converts ‘this’ n-vector to latitude/longitude point.
Source:
##### Returns:
Latitude/longitude point equivalent to this n-vector.
Type
LatLon
##### Example
const p = new Nvector(0.500000, 0.500000, 0.707107).toLatLon(); // 45.0000°N, 045.0000°E

#### toString(dpopt, dpHeightopt) → {string}

Returns a string representation of ‘this’ (unit) n-vector. Height component is only shown if dpHeight is specified.
##### Parameters:
Name Type Attributes Default Description
dp number <optional>
3 Number of decimal places to display.
dpHeight number <optional>
null Number of decimal places to use for height; default is no height display.
Source:
##### Returns:
Comma-separated x, y, z, h values.
Type
string
##### Example
new Nvector(0.5000, 0.5000, 0.7071).toString();        // [0.500,0.500,0.707]
new Nvector(0.5000, 0.5000, 0.7071, 1).toString(6, 0); // [0.500002,0.500002,0.707103+1m]