Documentation
¶
Overview ¶
Package quadtree is a generic, zero-alloc Quadtree.
Index ¶
- type Iter
- type Tree
- func (t *Tree[T]) Add(x, y, w, h float64, value T) (ok bool)
- func (t *Tree[T]) Del(x, y float64) (ok bool)
- func (t *Tree[T]) ForEach(x, y, w, h float64, iter Iter[T])
- func (t *Tree[T]) Get(x, y, w, h float64) (value T, ok bool)
- func (t *Tree[T]) KNearest(x, y, distance float64, k int, iter Iter[T])
- func (t *Tree[T]) Move(x, y, newX, newY float64) (ok bool)
- func (t *Tree[T]) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree[T any] struct { // contains filtered or unexported fields }
Tree is a quad-tree container.
func New ¶
New creates new, empty quad tree instance with given area width and height and maximum depth value.
func (*Tree[T]) Add ¶
Add adds rectangle, with top-left corner at (x, y) and given width and height.
func (*Tree[T]) KNearest ¶
KNearest iterates over k nearest for given coordinates within given distance.
Click to show internal directories.
Click to hide internal directories.