Function GeocentricCoordinate.tryFromComponents

Construct from finite X/Y/Z components without throwing.

static bool tryFromComponents(
  const T x,
  const T y,
  const T z,
  out GeocentricCoordinate result
) pure nothrow @nogc @safe;

Parameters

NameDescription
x Finite geocentric X component.
y Finite geocentric Y component.
z Finite geocentric Z component.
result Receives the constructed coordinate on success.

Returns

true on success; false when any component is NaN or infinite. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example checking finite geocentric components without throwing.

import geodesy;
GeocentricCoordinate!double point;
assert(GeocentricCoordinate!double.tryFromComponents(
    4_085_000.0, 1_260_000.0, 4_717_000.0, point));
assert(point.x == 4_085_000.0);