pathfinding

package
v0.0.0-...-a4aebfb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Infinity = math.Inf(1)

Functions

func PointEqual

func PointEqual(a image.Point, b image.Point) bool

default point equality function

Types

type NeighborsFunc

type NeighborsFunc func(int, int) []image.Point

neighbor points given a point x,y

type Path

type Path []image.Point

func FindPath

func FindPath(start image.Point, end image.Point, maxPath float64, tileCost TileCostFunc, neighbors NeighborsFunc, samePoint PointEqFunc) (Path, bool)

returns an array of points that is the shortest/cheapest path from start->end and true, or false if no such path exists * basically djikstra's shortest path algorithm

type PointEqFunc

type PointEqFunc func(image.Point, image.Point) bool

compare two points for equality. notably this should handle wrapping around the map

type TileCostFunc

type TileCostFunc func(int, int, int, int) float64

cost to move from (x1,y1) -> (x2,y2)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL