Function TopocentricFrame.geocentricToTopocentric

Convert geocentric Cartesian coordinates to local East/North/Up.

TopocentricCoordinate!T geocentricToTopocentric(
  const GeocentricCoordinate!T source
) const @safe;

Throws GeodesyValueException when the frame is invalid or no finite public result can be represented.

Parameters

NameDescription
source Geocentric coordinate in the frame linear unit.

Returns

Local East/North/Up in the same linear unit.

Throws

GeodesyValueException for an invalid frame or unrepresentable result.

Example

Example converting ECEF to local ENU.

import geodesy;
const origin = GeodeticCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208),
    171.0);
const frame = TopocentricFrame!double.fromGeodeticOrigin(
    wgs84!double(), origin);
const nearby = GeodeticCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20850),
    Longitude!double.fromDegrees(16.37210),
    175.0);
const xyz = geodeticToGeocentric(nearby, wgs84!double());
const local = frame.geocentricToTopocentric(xyz);
assert(local.east == local.east);