engine: azul3d.org/engine/dstarlite/grid Index | Files

package grid

import "azul3d.org/engine/dstarlite/grid"

Package grid implements D* Lite grid-based pathfinding.

Index

Package Files

grid.go

type Coord Uses

type Coord [2]int

Coord represents an single grid coordinate pair [x, y]

func (Coord) Dist Uses

func (a Coord) Dist(b Coord) float64

Dist returns manhattan distance between two coordinates

func (Coord) Equals Uses

func (a Coord) Equals(b dstarlite.State) bool

Implements dstarlite.State interface.

type Data Uses

type Data struct {
    // contains filtered or unexported fields
}

Data represents an actual grid's data.

func New Uses

func New(width, height int, start, goal Coord) *Data

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) Cost Uses

func (d *Data) Cost(aa, bb dstarlite.State) float64

Implements dstarlite.Data interface.

func (*Data) Dist Uses

func (d *Data) Dist(aa, bb dstarlite.State) float64

Implements dstarlite.Data interface.

func (*Data) Get Uses

func (d *Data) Get(pos Coord) (value float64, ok bool)

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) Goal Uses

func (d *Data) Goal() Coord

Goal returns the goal coordinate, as it is currently.

func (*Data) Plan Uses

func (d *Data) Plan() (path []Coord)

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) Pred Uses

func (d *Data) Pred(s dstarlite.State) []dstarlite.State

Implements dstarlite.Data interface.

func (*Data) Set Uses

func (d *Data) Set(pos Coord, value float64)

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) Size Uses

func (d *Data) Size() (width, height int)

Size returns the width and height of the grid.

func (*Data) Start Uses

func (d *Data) Start() Coord

Start returns the start coordinate, as it is currently.

func (*Data) Succ Uses

func (d *Data) Succ(s dstarlite.State) []dstarlite.State

Implements dstarlite.Data interface.

func (*Data) UpdateStart Uses

func (d *Data) UpdateStart(start Coord)

UpdateStart updates the starting position. This can be used to move a long the path efficiently.

Package grid imports 2 packages (graph). Updated 2017-02-27. Refresh now. Tools for package owners.