Function Longitude.tryFromRadians

Construct a longitude from radians without throwing.

static bool tryFromRadians(
  const T radians,
  out Longitude result
) pure nothrow @nogc @safe;

Parameters

NameDescription
radians Longitude in the closed interval [-pi,+pi].
result Receives the constructed longitude on success.

Returns

true on success; false for non-finite or out-of-domain input. Both antimeridian endpoints are accepted. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example checking longitude radians without throwing.

import geodesy;
Longitude!double longitude;
assert(Longitude!double.tryFromRadians(0.25, longitude));
assert(longitude.radians == 0.25);