navigationGenerated
Category: Packages · Manifest: use "kernels/";
Ways over a grid.
Description
Section titled “Description”Ways over a grid: how far each cell is from a seed by what each costs to enter, relaxed a pass at a time, and the step a walk takes toward it.
Layer: Foundation. Uses: no other package.
use "navigation.entpkg";Kernels
Section titled “Kernels”kernels/grid_path.ent— Ways over a grid of cells. Kernels:navigation.relax@1.
tests/ holds scenes and their replays, run on every backend:
grid.replay. Every Kernel of the package is reached by one of them.
Used by the slg example.
Kernels
Section titled “Kernels”| Kernel | Mode | Brief |
|---|---|---|
navigation.relax@1 |
map | One pass: each cell the nearer of what it is and its cheapest neighbor’s and its own cost (cost, blocked or more not entered). A node runs it times = N; carry previous <- result; from a seed (0 where it begins, grid_far() else). |
Methods
Section titled “Methods”| Function | Brief |
|---|---|
grid_far() -> Int |
Far: a cell not yet reached, or one none may reach. |
grid_inside(dist: Grid<Int>, c: IVec2) -> Bool |
|
grid_at(dist: Grid<Int>, c: IVec2) -> Int |
|
grid_step(dist: Grid<Int>, c: IVec2) -> IVec2 |
A step from c toward the seed of dist: the neighbor nearest it (the first of right, left, down, up when two are as near); c when none is nearer. |
off_segment(p: Vec2, a: Vec2, b: Vec2) -> Float |
How far point p is from the segment a to b. |
path_cover(dist: Grid<Int>, from: IVec2, to: IVec2, p: Vec2, half: Float) -> Float |
The walk from cell from down dist (its seed to) drawn at p (in cells: a cell’s middle is its index and a half): a line through each step’s middle half of a cell wide each side, and at to an arrow’s head pointing the way the last step goes; how much covers p (0 to 1). At most steps steps. |
Kernel descriptions
Section titled “Kernel descriptions”navigation.relax@1
Section titled “navigation.relax@1”One pass: each cell the nearer of what it is and its cheapest neighbor’s and its own cost (cost, blocked or more not entered). A node runs it times = N; carry previous <- result; from a seed (0 where it begins, grid_far() else).
| Mode | map |
| Requires | field.read, field.write |
| Inputs | previous: Grid<Int>, cost: Grid<Int> |
| Params | blocked: Int = 99 |
| Outputs | result: Grid<Int> |
| Source | packages/navigation.entpkg/kernels/grid_path.ent |
grid.replay

