Function Geodesic.tryDirect

Solve the direct geodesic problem without throwing.

bool tryDirect(
  const GeographicCoordinate!T start,
  const Angle!T initialAzimuth,
  const T distance,
  out GeodesicDirectResult!T result
) const pure nothrow @nogc @safe;

Starting from start, follow initialAzimuth for signed distance. Negative distance follows the same oriented geodesic backward. Returned longitude and final forward azimuth use the canonical interval from -pi inclusive to +pi exclusive. At zero distance the supplied oriented line is retained rather than applying inverse coincidence semantics.

Parameters

NameDescription
start Geographic start position.
initialAzimuth Initial forward azimuth; finite arbitrary-turn values are canonicalized by the solver.
distance Finite signed distance in the ellipsoid linear unit.
result Receives endpoint and final forward azimuth.

Returns

true when the prepared solver is valid and a finite representable result is produced; otherwise false. Before validation, result is reset to GeodesicDirectResult!T.init.

Example

Example using bool tryDirect( const GeographicCoordinate!T start, const Angle!T initialAzimuth, const T .

import geodesy;

const solver = Geodesic!double.fromEllipsoid(wgs84!double());
const start = GeographicCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208));

GeodesicDirectResult!double result;
assert(solver.tryDirect(
    start, Angle!double.fromDegrees(90.0), 1_000.0, result));
assert(result.position.longitude.degrees > 16.37208);