terrain

package
v0.0.0-...-7a6bf91 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sqrt2 = 1.414213
)

Variables

This section is empty.

Functions

func EuclidianDistance

func EuclidianDistance(s, e utils.IntPair) float64

func ManhattanDistance

func ManhattanDistance(s, e utils.IntPair) float64

func OctileDistance

func OctileDistance(s, e utils.IntPair) float64

Types

type QuadTreeTerrain

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

func NewQuadTreeTerrain

func NewQuadTreeTerrain(x int, y int, w int) *QuadTreeTerrain

Quad tree terrain should be square, hence only width They should also be powers of 2 in size, should maybe fix that

func (QuadTreeTerrain) CircleSeparation

func (tree QuadTreeTerrain) CircleSeparation(circ shapes.Circle) (utils.FloatPair, float64)

func (QuadTreeTerrain) DebugDrawTree

func (tree QuadTreeTerrain) DebugDrawTree(target *ebiten.Image)

func (QuadTreeTerrain) DebugDrawTree2

func (tree QuadTreeTerrain) DebugDrawTree2(target *ebiten.Image)

func (QuadTreeTerrain) DoesLineCollide

func (tree QuadTreeTerrain) DoesLineCollide(ray shapes.Line) bool

func (QuadTreeTerrain) FindPath

func (tree QuadTreeTerrain) FindPath(s, e utils.IntPair) []utils.IntPair

func (QuadTreeTerrain) GetAdjacentCorners

func (tree QuadTreeTerrain) GetAdjacentCorners(x, y int) []utils.IntPair

func (QuadTreeTerrain) GetClosestCorner

func (tree QuadTreeTerrain) GetClosestCorner(x, y float64) (bool, int, int)

Returns false if starting position is not inside this tree, returned position will not be useful in that case Doesn't actually return the closest corner, just the closest corner of the leaf we are in, which is close enough

func (QuadTreeTerrain) ImprovePath

func (tree QuadTreeTerrain) ImprovePath(path []utils.IntPair) []utils.IntPair

func (QuadTreeTerrain) ImprovePathBeginning

func (tree QuadTreeTerrain) ImprovePathBeginning(path []utils.IntPair) []utils.IntPair

func (*QuadTreeTerrain) Join

func (tree *QuadTreeTerrain) Join()

func (*QuadTreeTerrain) LoadImageData

func (tree *QuadTreeTerrain) LoadImageData(image *ebiten.Image)

func (QuadTreeTerrain) Neighbours

func (tree QuadTreeTerrain) Neighbours(n utils.IntPair) []utils.IntPair

func (*QuadTreeTerrain) Split

func (tree *QuadTreeTerrain) Split() bool

Returns false if splitting failed (probably due to reaching max depth)

Jump to

Keyboard shortcuts

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