Function Angle.tryFromDegrees

Construct from degrees without throwing.

static bool tryFromDegrees(
  const T degrees,
  out Angle result
) pure nothrow @nogc @safe;

Parameters

NameDescription
degrees Finite angle in degrees.
result Receives the constructed angle on success.

Returns

true on success; false for NaN, infinity, or when conversion to scalar T does not produce a finite radian value. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example checking degree input without throwing.

import geodesy;
Angle!double angle;
assert(Angle!double.tryFromDegrees(90.0, angle));
assert(angle.degrees == 90.0);