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) -> SearchResult
pub fn sample_path(&self, start: Point) -> SearchResult
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,
) -> SearchResult
pub fn sample_path_limited( &self, start: Point, max_steps: usize, ) -> SearchResult
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 more