qtree

package
v0.0.0-...-96f3e8a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2018 License: BSD-2-Clause-Views Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false
View Source
var Indent = 0

Functions

This section is empty.

Types

type Config

type Config struct {
	SplitCount     int     "Exclusive upper bound before splitting a node"
	SplitSizeRatio float64 "Elements must be small enough to split"
	Height         int     "Max depth of search tree"
}

func ConfigDefault

func ConfigDefault() (cfg Config)

type Item

type Item interface {
	geom.Bounded
	Equals(oi interface{}) bool
}

type Tree

type Tree struct {
	Count int

	//a promise that nothing added will be outside this bounds
	UpperBounds geom.Rect

	//smallest rect that contains all current items
	Bounds geom.Rect

	Partition geom.Coord

	Subtrees [4]*Tree

	Elements    map[Item]bool
	BigElements map[Item]bool
	// contains filtered or unexported fields
}

func New

func New(cfg Config, bounds geom.Rect) (me *Tree)

func (*Tree) CollectInside

func (me *Tree) CollectInside(bounds geom.Rect, collection map[Item]bool)

func (*Tree) CollectIntersect

func (me *Tree) CollectIntersect(bounds geom.Rect, collection map[Item]bool)

func (*Tree) Do

func (me *Tree) Do(foo func(x Item))

func (*Tree) Enumerate

func (me *Tree) Enumerate(collection map[Item]bool)

func (*Tree) Find

func (me *Tree) Find(element Item) (found Item, ok bool)

func (*Tree) FindOrInsert

func (me *Tree) FindOrInsert(element Item) (found Item, inserted bool)

func (*Tree) Insert

func (me *Tree) Insert(element Item) (inserted bool)

func (*Tree) IsBig

func (me *Tree) IsBig(bounds geom.Rect) bool

func (*Tree) Items

func (me *Tree) Items() (rch <-chan Item)

func (*Tree) Iterate

func (me *Tree) Iterate() (rch <-chan Item)

func (*Tree) Remove

func (me *Tree) Remove(element Item) (removed bool)

func (*Tree) RemoveInside

func (me *Tree) RemoveInside(bounds geom.Rect, collection map[Item]bool)

func (*Tree) RemoveIntersect

func (me *Tree) RemoveIntersect(bounds geom.Rect, collection map[Item]bool)

func (*Tree) Size

func (me *Tree) Size() int

func (*Tree) String

func (me *Tree) String() string

Jump to

Keyboard shortcuts

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