Geodesic.tryDirect - multiple declarations
Function Geodesic.tryDirect
Find a destination from a start position, bearing and distance.
bool tryDirect(
const GeographicCoordinate!T start,
const Angle!T initialAzimuth,
const T distance,
out GeodesicDirectResult!T result
) const pure nothrow @nogc @safe;
Use this checked form when you know the direction and distance along a geodesic and want the endpoint without using exceptions.
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
| Name | Description |
|---|---|
| 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.
Function Geodesic.tryDirect
Solve the direct geodesic and its advanced segment quantities.
bool tryDirect(
const GeographicCoordinate!T start,
const Angle!T initialAzimuth,
const T distance,
out GeodesicDirectResult!T result,
out GeodesicQuantities!T quantities
) const pure nothrow @nogc @safe;
This additive overload preserves the frozen v1 direct result while requesting reduced length, geodesic scales, and signed area for the same oriented signed-distance segment.
Parameters
| Name | Description |
|---|---|
| start | Geographic start position. |
| initialAzimuth | Initial forward azimuth. |
| distance | Finite signed distance in the ellipsoid linear unit. |
| result | Receives endpoint and final forward azimuth. |
| quantities | Receives m12, M12, M21, and S12. |
Returns
true when all requested values are finite and representable;
otherwise false. Both outputs are reset to on entry.
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);