internal

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatFloat

func FormatFloat(f float64, prec int, bitSize int) string

func FormatFloat32

func FormatFloat32(f float32, prec int) string

Types

type Grid

type Grid[T any] map[GridPos]T

A simple abstraction of an infinite(ish) using a map to store values

type GridPos

type GridPos struct {
	X, Y int16
}

Type representing positions in a grid

func (GridPos) ChebyshevDistance

func (a GridPos) ChebyshevDistance(b GridPos) float32

Returns the Chebyshev distance between two points

d = max(abs(a.X-b.X), abs(a.Y-b.Y))

func (GridPos) Max

func (g GridPos) Max(p GridPos) GridPos

func (GridPos) Min

func (g GridPos) Min(p GridPos) GridPos

func (GridPos) ToVec

func (g GridPos) ToVec() vec.Vec2

Returns a vec.Vec2 with the same values as the grid position

type PriorityQueue

type PriorityQueue[T any] struct {
	// contains filtered or unexported fields
}

PriorityQueue is a heap-based priority queue using the standard library heap

func (*PriorityQueue[T]) Empty

func (pq *PriorityQueue[T]) Empty() bool

Empty returns true when the queue is empty

func (*PriorityQueue[T]) Pop

func (pq *PriorityQueue[T]) Pop() (*T, bool)

Remove the item at the top of the queue and return it Returns (nil, false) if the queue is empty

func (*PriorityQueue[T]) Push

func (pq *PriorityQueue[T]) Push(data T, priority int)

Push a new element with the given priority

Directories

Path Synopsis
Functions for operating on 32bit floats, mostly just wrappers around the functions from std/math
Functions for operating on 32bit floats, mostly just wrappers around the functions from std/math

Jump to

Keyboard shortcuts

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