pub struct Leg {
pub from: Position,
pub to: Position,
pub port_xtd_nm: f64,
pub starboard_xtd_nm: f64,
pub sailing: Sailing,
}Expand description
One leg of a route, with the water it is allowed to wander into.
Known limitation: a leg crossing the antimeridian is not handled. The band is built in longitude and latitude, so a leg from 179°E to 179°W would be drawn the long way around the world, checking the wrong hemisphere. Splitting such a leg at 180° and checking the halves separately would fix this; not yet implemented.
Fields§
§from: PositionWhere the leg starts.
to: PositionWhere it ends.
port_xtd_nm: f64How far the vessel may stray to port of the track, in nautical miles.
starboard_xtd_nm: f64The same to starboard.
sailing: SailingHow the leg is drawn.
Implementations§
Source§impl Leg
impl Leg
Sourcepub fn symmetric(from: Position, to: Position, half_width_nm: f64) -> Self
pub fn symmetric(from: Position, to: Position, half_width_nm: f64) -> Self
A leg with the same tolerance to port and starboard, for a caller with a single corridor figure and no route to supply per-side values.
Sourcepub fn narrowest_xtd_nm(&self) -> f64
pub fn narrowest_xtd_nm(&self) -> f64
The tighter of the two tolerances – the precision the chart data must resolve to, regardless of how much room the wider side allows.
Sourcepub fn point_at(&self, along_nm: f64) -> Position
pub fn point_at(&self, along_nm: f64) -> Position
The point along_nm from the start, on the track itself.
Sourcepub fn course_at(&self, position: Position, along_nm: f64) -> f64
pub fn course_at(&self, position: Position, along_nm: f64) -> f64
The course being steered at a point on the track, degrees true.
Constant on a rhumb line; changes continuously on a great circle, so the band is offset from the local course at each point rather than from a single bearing for the whole leg.
Trait Implementations§
impl Copy for Leg
impl StructuralPartialEq for Leg
Auto Trait Implementations§
impl Freeze for Leg
impl RefUnwindSafe for Leg
impl Send for Leg
impl Sync for Leg
impl Unpin for Leg
impl UnsafeUnpin for Leg
impl UnwindSafe for Leg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more