pub struct PathBaseline<const N: usize> {
pub positions: [LatLon; N],
pub perpendiculars: [TangentMetres; N],
pub perp_scale_pos: [f64; N],
pub perp_scale_neg: [f64; N],
}Expand description
Reference path that the init families perturb.
Each particle is built by walking the baseline and adding
offset[i] * scale[i] metres along perpendiculars[i] at every
interior waypoint. Scale is perp_scale_pos for offset ≥ 0,
perp_scale_neg otherwise — asymmetric so a polyline running
closer to one coast can still wiggle freely on the other side.
Decouples “where the path goes” from “how particles vary.”
Fields§
§positions: [LatLon; N]§perpendiculars: [TangentMetres; N]Outward perpendicular, unit east-north tangent (90° CCW of the local tangent direction).
perp_scale_pos: [f64; N]Perturbation scale (metres) for the +perpendicular side.
perp_scale_neg: [f64; N]Perturbation scale (metres) for the −perpendicular side.
Implementations§
Source§impl<const N: usize> PathBaseline<N>
impl<const N: usize> PathBaseline<N>
Sourcepub fn straight_line(bounds: &RouteBounds) -> Self
pub fn straight_line(bounds: &RouteBounds) -> Self
Straight-line lerp baseline. Symmetric scale = half the haversine route length on both sides.
Sourcepub fn from_polyline<LS: LandmassSource>(
polyline: &[LatLon],
bounds: &RouteBounds,
landmass: &LS,
) -> Self
pub fn from_polyline<LS: LandmassSource>( polyline: &[LatLon], bounds: &RouteBounds, landmass: &LS, ) -> Self
Topology-aware baseline from a polyline (e.g. an A* sea path). Samples N waypoints uniformly by arc length and probes the signed-distance field for the perpendicular clearance on each side, so a path running close to one coast still wiggles freely on the open-sea side.
Sourcepub fn from_polyline_land_respecting<LS: LandmassSource>(
polyline: &[LatLon],
bounds: &RouteBounds,
landmass: &LS,
) -> Self
pub fn from_polyline_land_respecting<LS: LandmassSource>( polyline: &[LatLon], bounds: &RouteBounds, landmass: &LS, ) -> Self
Sampler that prioritises land-free chords over uniform spacing.
Use for benchmark routes (unperturbed xy) so “Bench land”
reads 0 on a correctly-routed input. Not for PSO init seeds —
tighter sampling hugs the coastline, and perpendicular kicks
then push particles into land too often.
Trait Implementations§
Source§impl<const N: usize> Clone for PathBaseline<N>
impl<const N: usize> Clone for PathBaseline<N>
Source§fn clone(&self) -> PathBaseline<N>
fn clone(&self) -> PathBaseline<N>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<const N: usize> Freeze for PathBaseline<N>
impl<const N: usize> RefUnwindSafe for PathBaseline<N>
impl<const N: usize> Send for PathBaseline<N>
impl<const N: usize> Sync for PathBaseline<N>
impl<const N: usize> Unpin for PathBaseline<N>
impl<const N: usize> UnsafeUnpin for PathBaseline<N>
impl<const N: usize> UnwindSafe for PathBaseline<N>
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