Documentation ¶
Overview ¶
Package grid implements D* Lite grid-based pathfinding.
Index ¶
- type Coord
- type Data
- func (d *Data) Cost(aa, bb dstarlite.State) float64
- func (d *Data) Dist(aa, bb dstarlite.State) float64
- func (d *Data) Get(pos Coord) (value float64, ok bool)
- func (d *Data) Goal() Coord
- func (d *Data) Plan() (path []Coord)
- func (d *Data) Pred(s dstarlite.State) []dstarlite.State
- func (d *Data) Set(pos Coord, value float64)
- func (d *Data) Size() (width, height int)
- func (d *Data) Start() Coord
- func (d *Data) Succ(s dstarlite.State) []dstarlite.State
- func (d *Data) UpdateStart(start Coord)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coord ¶
type Coord [2]int
Coord represents an single grid coordinate pair [x, y]
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data represents an actual grid's data.
func New ¶
New returns an new grid data structure given an width and height where each cell indicates the cost of traversal.
If the width or height are <= 0; an panic will occur.
If either start or goal coordinates are outside the coordinates of the grid, an panic will occur.
func (*Data) Get ¶
Get returns the attached interface value from the given coordinate on the grid.
If the coordinate is outside of the grid's dimensions, ok will equal false.
func (*Data) Plan ¶
Plan recomputes the lowest cost path through the map, taking into account changes in start location and edge costs.
If no path is found, nil is returned.
func (*Data) Set ¶
Set changes the cost of traversal to the given coordinate on the grid to the specified value.
If the coordinate is outside of the grid's dimensions, an panic will occur.
func (*Data) UpdateStart ¶
UpdateStart updates the starting position. This can be used to move a long the path efficiently.