prtree

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

prtree

GoDoc

Just a hybrid data structure that slams my rtree and ptree libraries into one.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PRTree

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

PRTree is a tree for storing points and rects

func New

func New(min, max [2]float64) *PRTree

New returns a new PRTree

func (*PRTree) Bounds

func (tr *PRTree) Bounds() (min, max [2]float64)

Bounds returns the minimum bounding box

func (*PRTree) Children

func (tr *PRTree) Children(parent interface{}, reuse []child.Child,
) (children []child.Child)

Children returns all children for parent node. If parent node is nil then the root nodes should be returned. The reuse buffer is an empty length slice that can optionally be used to avoid extra allocations.

func (*PRTree) Delete

func (tr *PRTree) Delete(min, max [2]float64, data interface{})

Delete an item from the structure

func (*PRTree) Insert

func (tr *PRTree) Insert(min, max [2]float64, data interface{})

Insert an item into the structure

func (*PRTree) Len

func (tr *PRTree) Len() int

Len returns the number of items in tree

func (*PRTree) Replace

func (tr *PRTree) Replace(
	oldMin, oldMax [2]float64, oldData interface{},
	newMin, newMax [2]float64, newData interface{},
)

Replace an item in the structure. This is effectively just a Delete followed by an Insert. But for some structures it may be possible to optimize the operation to avoid multiple passes

func (*PRTree) Scan

func (tr *PRTree) Scan(iter func(min, max [2]float64, data interface{}) bool)

Scan iterates through all data in tree in no specified order.

func (*PRTree) Search

func (tr *PRTree) Search(
	min, max [2]float64,
	iter func(min, max [2]float64, data interface{}) bool,
)

Search the structure for items that intersects the rect param

Jump to

Keyboard shortcuts

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