tryClosestGeodesicIntersection - multiple declarations

Function tryClosestGeodesicIntersection

Find the closest intersection of two prepared oriented geodesics.

bool tryClosestGeodesicIntersection(T)(
  const Geodesic!T solver,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  const T referenceOnFirst,
  const T referenceOnSecond,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

This one-shot overload preserves the established API. Repeated callers can prepare GeodesicIntersectionSolver once and use the matching overload.

Function tryClosestGeodesicIntersection

Find the closest intersection using reusable intersection-family state.

bool tryClosestGeodesicIntersection(T)(
  const GeodesicIntersectionSolver!T intersector,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  const T referenceOnFirst,
  const T referenceOnSecond,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryClosestGeodesicIntersection

Zero-reference prepared-line overload.

bool tryClosestGeodesicIntersection(T)(
  const Geodesic!T solver,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryClosestGeodesicIntersection

Zero-reference overload using reusable intersection-family state.

bool tryClosestGeodesicIntersection(T)(
  const GeodesicIntersectionSolver!T intersector,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryClosestGeodesicIntersection

Construct lines from origins and azimuths and find the closest intersection.

bool tryClosestGeodesicIntersection(T)(
  const Geodesic!T solver,
  const GeographicCoordinate!T firstStart,
  const Angle!T firstAzimuth,
  const GeographicCoordinate!T secondStart,
  const Angle!T secondAzimuth,
  const T referenceOnFirst,
  const T referenceOnSecond,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryClosestGeodesicIntersection

Construct lines and find the closest intersection using reusable family state.

bool tryClosestGeodesicIntersection(T)(
  const GeodesicIntersectionSolver!T intersector,
  const GeographicCoordinate!T firstStart,
  const Angle!T firstAzimuth,
  const GeographicCoordinate!T secondStart,
  const Angle!T secondAzimuth,
  const T referenceOnFirst,
  const T referenceOnSecond,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryClosestGeodesicIntersection

Zero-reference origin/azimuth overload.

bool tryClosestGeodesicIntersection(T)(
  const Geodesic!T solver,
  const GeographicCoordinate!T firstStart,
  const Angle!T firstAzimuth,
  const GeographicCoordinate!T secondStart,
  const Angle!T secondAzimuth,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryClosestGeodesicIntersection

Zero-reference origin/azimuth overload using reusable family state.

bool tryClosestGeodesicIntersection(T)(
  const GeodesicIntersectionSolver!T intersector,
  const GeographicCoordinate!T firstStart,
  const Angle!T firstAzimuth,
  const GeographicCoordinate!T secondStart,
  const Angle!T secondAzimuth,
  out GeodesicClosestIntersectionResult!T result
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Example

Example checking the closest intersection of two oriented geodesics without throwing.

const solver = Geodesic!double.fromEllipsoid(wgs84!double());

const firstStart = GeographicCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(0.0),
    Longitude!double.fromDegrees(-20.0));

const secondStart = GeographicCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(10.0),
    Longitude!double.fromDegrees(20.0));

GeodesicClosestIntersectionResult!double result;

assert(tryClosestGeodesicIntersection(
    solver,
    firstStart,
    Angle!double.fromDegrees(45.0),
    secondStart,
    Angle!double.fromDegrees(-60.0),
    result));

assert(result.isValid);