Skip to main content

Crate navcore_route_find

Crate navcore_route_find 

Source
Expand description

Automatic route generation: the shortest path [enc_store::check_leg] calls safe between two positions.

Safety decisions belong to [enc_store::check_leg], the same function route_check uses to validate a route a human drew. This crate generates candidate waypoints and searches them:

  1. grid lays a lattice of candidate positions over the area between from and to, and hazards marks which of them a vessel cannot stand on, from a single chart query rather than one per candidate.
  2. search finds the shortest safe path over that lattice with A*.
  3. smooth straightens the resulting zig-zag into a short waypoint list and calls check_leg on every straightened leg, so every leg this crate hands back is approved at the vessel’s real corridor, not the lattice’s approximation of it.

The lattice, hazard test and search generalize to weather routing: only the edge cost (distance here) would change to sailing time under a wind forecast.

Structs§

FindOptions
What a route is being planned for, and how far around the direct line to search.

Enums§

FindError
Everything that can go wrong finding a route.
LandCacheError
Everything that can go wrong baking a chart’s land cache.

Functions§

bake_land_cache
Bakes a land cache for chart, covering whatever area detect_coverage_area finds plus RASTER_PADDING_DEG, and writes it to <chart.path()>.hazcache (or out, if given) – run once, ahead of time, by enc-check bake, never at route-query time.
find_dock_to_dock_route
A check_leg-approved route between two harbours: from_harbor’s gateway, crate::find_route’s open-water search between the two gateways, then to_harbor’s gateway, combining two find_gateway calls with the open-water search between them so a caller does not stitch them by hand.
find_gateway
The nearest point to harbor that crate::find_route’s open-water search can use as a from or to: harbor itself if that is already clear, otherwise the first point found searching outward in expanding rings. See this module’s own doc for the search itself and what it does not attempt.
find_gateway_route
A check_leg-approved route from harbor out to find_gateway’s confirmed destination: the actual path there, not just the point, validated end to end from harbor’s exact position onward. See this module’s own doc, “A second approach”, for how this compares to find_gateway.
find_route
The shortest route between from and to that check_leg calls safe for the vessel described in options.