Function TopocentricFrame.tryFromGeocentricOrigin

Prepare a frame from a geocentric origin without throwing.

static bool tryFromGeocentricOrigin(
  const Ellipsoid!T ellipsoid,
  const GeocentricCoordinate!T origin,
  out TopocentricFrame result
) pure nothrow @nogc @safe;

The supplied represented X/Y/Z values are retained after promotion to the working scalar; they are not reconstructed from the derived geodetic coordinate. Orientation follows canonical EPSG 9602 reverse

semantics

the exact geocentre is rejected, a non-zero rotation-axis point is accepted with canonical zero longitude, and deep-interior origins inherit the canonical nearest-ellipsoid/min-|h| solution.

Parameters

NameDescription
ellipsoid Valid ellipsoid defining the frame linear unit.
origin Geocentric origin in the same linear unit.
result Receives the prepared frame on success.

Returns

true when the origin has a defined canonical geodetic orientation and finite ENU state; otherwise false. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example preparing an ENU frame from an ECEF origin without throwing.

import geodesy;
const origin = GeodeticCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208),
    171.0);
const xyz = geodeticToGeocentric(origin, wgs84!double());
TopocentricFrame!double frame;
assert(TopocentricFrame!double.tryFromGeocentricOrigin(
    wgs84!double(), xyz, frame));
assert(frame.isValid);