Skip to main content

find_gateway_route

Function find_gateway_route 

Source
pub fn find_gateway_route(
    chart: &ChartStore,
    harbor: Position,
    options: &FindOptions,
) -> Result<Option<Vec<Position>>, FindError>
Expand description

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.

Two phases, at two corridors, joined at whichever node the first phase reaches: search::nearest_safe threads harbor’s immediate obstruction – a marina basin, a breakwater gap – at GATEWAY_ESCAPE_RADIUS_NM, tighter than a caller’s open-water port_xtd_nm/starboard_xtd_nm, since harbour water is routinely narrower than that margin calls safe; then crate::find_route takes over at the caller’s real corridor for the rest of the passage. Both halves are straightened and check_leg-approved by smooth::straighten before being joined.

Ok(None) when find_gateway finds no destination, when harbor has no check_leg-safe way out of its immediate obstruction within GATEWAY_ESCAPE_MAX_NODES lattice steps, or when crate::find_route finds no safe passage from there to the gateway.

Depth is not tested during the escape phase – only land, a no-entry restricted area, or the tighter corridor width can block it – on the mariner’s own instruction: a marina berth’s charted depth is routinely less trustworthy than the mariner’s own knowledge of it (confirmed against a position the chart placed to only 6 m accuracy at its compilation scale). find_gateway’s far target and the open-water passage crate::find_route finds beyond launch are unaffected: depth still applies exactly as options asks everywhere past the harbour’s immediate obstruction.

§Errors

If the chart cannot be read.