Function TopocentricFrame.tryGeocentricToTopocentric
Convert geocentric Cartesian coordinates to local East/North/Up.
bool tryGeocentricToTopocentric(
const GeocentricCoordinate!T source,
out TopocentricCoordinate!T result
) const pure nothrow @nogc @safe;
Implements EPSG coordinate operation method 9836.
Subtraction from the Earth-scale frame origin is performed in the frame's prepared working scalar before any narrowing to public scalar T.
Parameters
| Name | Description |
|---|---|
| source | Geocentric coordinate in the frame linear unit. |
| result | Receives local East/North/Up on success. |
Returns
true for a valid frame and finite representable result; otherwise
false. On failure result is initialized to on entry and has no guaranteed value on failure.
Example
Example converting ECEF to local ENU 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);
const nearby = GeodeticCoordinate!double .fromComponents(
Latitude!double .fromDegrees(48.20850),
Longitude!double .fromDegrees(16.37210),
175.0);
const xyz = geodeticToGeocentric(nearby, wgs84!double());
TopocentricCoordinate!double local;
assert(frame .tryGeocentricToTopocentric(xyz, local));
assert(local .up == local .up);