pub struct PreparedFlowField { /* private fields */ }Expand description
Prepared same-goal flow field (integration + direction per cell).
Immutable after FlowFieldBuilder::preprocess. Safe to sample from many
independent starts without mutating the field.
Implementations§
Source§impl PreparedFlowField
impl PreparedFlowField
Sourcepub fn integration_at(&self, point: Point) -> Option<u32>
pub fn integration_at(&self, point: Point) -> Option<u32>
Distance-to-goal in grid steps, if the cell can reach the goal.
Sourcepub fn direction_at(&self, point: Point) -> FlowDirection
pub fn direction_at(&self, point: Point) -> FlowDirection
Greedy cardinal step stored for point, or FlowDirection::None when
out of bounds, blocked, goal, or unreachable.
Sourcepub fn sample_path(
&self,
start: Point,
) -> Result<SearchOutcome<Path, SearchStats>, GridSearchError>
pub fn sample_path( &self, start: Point, ) -> Result<SearchOutcome<Path, SearchStats>, GridSearchError>
Greedy walk along the flow field from start toward the goal.
On uniform unit-cost 4-way grids, length matches A*. Stops on goal,
stuck cell, or max_steps (default: width*height).
§Errors
Returns GridSearchError::InvalidStart when start is blocked or
outside the prepared grid.
Sourcepub fn sample_path_limited(
&self,
start: Point,
max_steps: usize,
) -> Result<SearchOutcome<Path, SearchStats>, GridSearchError>
pub fn sample_path_limited( &self, start: Point, max_steps: usize, ) -> Result<SearchOutcome<Path, SearchStats>, GridSearchError>
Samples at most max_steps flow edges.
§Errors
Returns GridSearchError::InvalidStart when start is blocked or
outside the prepared grid. GridSearchError::StepLimitReached reports
a reachable sample truncated by max_steps.
Trait Implementations§
Source§impl Clone for PreparedFlowField
impl Clone for PreparedFlowField
Source§fn clone(&self) -> PreparedFlowField
fn clone(&self) -> PreparedFlowField
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 Freeze for PreparedFlowField
impl RefUnwindSafe for PreparedFlowField
impl Send for PreparedFlowField
impl Sync for PreparedFlowField
impl Unpin for PreparedFlowField
impl UnsafeUnpin for PreparedFlowField
impl UnwindSafe for PreparedFlowField
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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