tryAllGeodesicIntersections - multiple declarations

Function tryAllGeodesicIntersections

Enumerate all intersections within an L1 displacement radius.

bool tryAllGeodesicIntersections(T)(
  const GeodesicIntersectionSolver!T intersector,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  const T maxDisplacement,
  const T referenceOnFirst,
  const T referenceOnSecond,
  GeodesicIntersectionPoint!T[] output,
  ref GeodesicIntersectionWorkspace!T workspace,
  out GeodesicIntersectionEnumeration enumeration
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

The core path is allocation-free. Output storage may be shorter than the result set; in that case the canonical prefix is written and truncated is true. Workspace storage must be sufficient to compute the exact total.

Function tryAllGeodesicIntersections

One-shot all-intersection enumeration using the same mathematical kernel.

bool tryAllGeodesicIntersections(T)(
  const Geodesic!T solver,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  const T maxDisplacement,
  const T referenceOnFirst,
  const T referenceOnSecond,
  GeodesicIntersectionPoint!T[] output,
  ref GeodesicIntersectionWorkspace!T workspace,
  out GeodesicIntersectionEnumeration enumeration
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryAllGeodesicIntersections

Zero-reference overload using prepared state.

bool tryAllGeodesicIntersections(T)(
  const GeodesicIntersectionSolver!T intersector,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  const T maxDisplacement,
  GeodesicIntersectionPoint!T[] output,
  ref GeodesicIntersectionWorkspace!T workspace,
  out GeodesicIntersectionEnumeration enumeration
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Function tryAllGeodesicIntersections

Zero-reference one-shot overload.

bool tryAllGeodesicIntersections(T)(
  const Geodesic!T solver,
  const GeodesicLine!T firstLine,
  const GeodesicLine!T secondLine,
  const T maxDisplacement,
  GeodesicIntersectionPoint!T[] output,
  ref GeodesicIntersectionWorkspace!T workspace,
  out GeodesicIntersectionEnumeration enumeration
) pure nothrow @nogc @safe
if (isGeodesyScalar!T);

Example

Example enumerating intersections without throwing.

const solver = Geodesic!double.fromEllipsoid(wgs84!double());
GeodesicIntersectionSolver!double intersector;
assert(GeodesicIntersectionSolver!double.tryFromGeodesic(
    solver, intersector));

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

GeodesicLine!double firstLine;
GeodesicLine!double secondLine;

assert(GeodesicLine!double.tryFromGeodesic(
    solver, firstStart, Angle!double.fromDegrees(30.0), firstLine));
assert(GeodesicLine!double.tryFromGeodesic(
    solver, secondStart, Angle!double.fromDegrees(120.0), secondLine));

GeodesicIntersectionWorkspaceEntry!double[16] starts;
bool[16] skip;
GeodesicIntersectionWorkspaceEntry!double[32] found;
GeodesicIntersectionWorkspaceEntry!double[16] centers;
GeodesicIntersectionWorkspace!double workspace;

assert(GeodesicIntersectionWorkspace!double.tryFromStorage(
    starts[], skip[], found[], centers[], workspace));

GeodesicIntersectionPoint!double[8] output;
GeodesicIntersectionEnumeration enumeration;

assert(tryAllGeodesicIntersections(
    intersector,
    firstLine,
    secondLine,
    1_000_000.0,
    output[],
    workspace,
    enumeration));

assert(enumeration.isValid);
assert(enumeration.total >= 1);