Geodesic.tryInverse - multiple declarations
Function Geodesic.tryInverse
Find the shortest surface distance and bearings between two positions.
bool tryInverse(
const GeographicCoordinate!T start,
const GeographicCoordinate!T end,
out GeodesicInverseResult!T result
) const pure nothrow @nogc @safe;
Use this checked form for start and end coordinates when failure
should be reported as false instead of an exception. The result
includes distance, initial bearing and final forward bearing.
The final azimuth is the forward heading of the same oriented geodesic continuing beyond the endpoint, not the back azimuth. Coincident endpoints return canonical positive-zero distance and azimuths. Distance uses the ellipsoid linear unit; azimuths use the canonical interval from -pi inclusive to +pi exclusive.
Parameters
| Name | Description |
|---|---|
| start | Geographic start position. |
| end | Geographic endpoint. |
| result | Receives distance, initial azimuth, and final azimuth. |
Returns
true when the prepared solver is valid and a finite representable
shortest-geodesic solution is produced; otherwise false. Before
validation, result is reset to GeodesicInverseResult!T.
Function Geodesic.tryInverse
Solve the shortest inverse geodesic and its advanced segment quantities.
bool tryInverse(
const GeographicCoordinate!T start,
const GeographicCoordinate!T end,
out GeodesicInverseResult!T result,
out GeodesicQuantities!T quantities
) const pure nothrow @nogc @safe;
This overload is additive to the frozen v1 inverse surface. Requesting
quantities enables reduced length, geodesic scales, and signed area;
the ordinary three-output tryInverse remains the lean distance and
azimuth path.
Parameters
| Name | Description |
|---|---|
| start | Geographic start position. |
| end | Geographic endpoint. |
| result | Receives distance plus initial and final forward azimuths. |
| 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 tryInverse( const GeographicCoordinate!T start, const GeographicCoordinate!T end, out.
import geodesy;
const solver = Geodesic!double .fromEllipsoid(wgs84!double());
const vienna = GeographicCoordinate!double .fromComponents(
Latitude!double .fromDegrees(48.20849),
Longitude!double .fromDegrees(16.37208));
const newYork = GeographicCoordinate!double .fromComponents(
Latitude!double .fromDegrees(40.7128),
Longitude!double .fromDegrees(-74.0060));
GeodesicInverseResult!double result;
assert(solver .tryInverse(vienna, newYork, result));
assert(result .distance > 6_000_000.0);
assert(result .distance < 7_000_000.0);