Function TopocentricFrame.tryTopocentricToGeocentric

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

bool tryTopocentricToGeocentric(
  const TopocentricCoordinate!T source,
  out GeocentricCoordinate!T result
) const pure nothrow @nogc @safe;

Implements the reverse direction of EPSG method 9836. Because the forward rotation is orthonormal, the reverse uses its transpose and then restores the prepared geocentric origin.

Parameters

NameDescription
source Local East/North/Up in the frame linear unit.
result Receives the geocentric coordinate on success.

Returns

true for a valid frame and finite representable result; otherwise false. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example converting local ENU to ECEF without throwing.

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);
GeocentricCoordinate!double xyz;
assert(frame.tryTopocentricToGeocentric(
    TopocentricCoordinate!double.init, xyz));
assert(xyz.x == xyz.x);