pub struct PathingGrid {
    pub grid: BoolGrid,
    pub neighbours: SimpleGrid<u8>,
    pub components: UnionFind<usize>,
    pub components_dirty: bool,
}
Expand description

PathingGrid maintains information about components using a UnionFind structure in addition to the raw bool grid values in the BoolGrid that determine whether a space is occupied (true) or empty (false). It also records neighbours in u8 format for fast lookups during search. Implements Grid by building on BoolGrid.

Fields

grid: BoolGridneighbours: SimpleGrid<u8>components: UnionFind<usize>components_dirty: bool

Implementations

Retrieves the component id a given Point belongs to.

Checks if start and goal are on the same component.

Checks if any neighbour of the goal is on the same component as the start.

Computes a path from start to goal using JPS. If approximate is true, then it will path to one of the neighbours of the goal, which is useful if goal itself is blocked. The heuristic used is the Chebyshev distance.

Computes a path from start to one of the given goals. This is done by taking the Chebyshev distance to the closest goal as heuristic value.

The raw waypoints (jump points) from which get_path_multiple_goals makes a path.

The raw waypoints (jump points) from which get_path_single_goal makes a path.

Regenerates the components if they are marked as dirty.

Generates a new UnionFind structure and links up grid neighbours to the same components.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Updates a position on the grid. Joins newly connected components and flags the components as dirty if components are (potentially) broken apart into multiple.

Gets the index corresponding to a coordinate, which is row-wise.

Tests whether a point is in bounds.

Tests whether an index is in bounds.

Sets a given rectangle on the grid to the value.

Retrieves the rectangle corresponding to the grid dimensions at the origin.

Retrieves a column-wise vector of grid values in the given rectangle.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.