rtree

package
v0.0.0-...-19fadcf Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT, MIT Imports: 0 Imported by: 0

README

RTree

Original code by Josh Baker, adapted to be compatible with Gio.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Child

type Child struct {
	Min, Max [2]float32
	Data     interface{}
	Item     bool
}

type RTree

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

RTree ...

func (*RTree) Bounds

func (tr *RTree) Bounds() (min, max [2]float32)

Bounds returns the minimum bounding rect

func (*RTree) Children

func (tr *RTree) Children(
	parent interface{},
	reuse []Child,
) []Child

Children is a utility function that returns all children for parent node. If parent node is nil then the root nodes should be returned. The min, max, data, and items slices all must have the same lengths. And, each element from all slices must be associated. Returns true for `items` when the the item at the leaf level. The reuse buffers are empty length slices that can optionally be used to avoid extra allocations.

func (*RTree) Delete

func (tr *RTree) Delete(min, max [2]float32, data interface{}) bool

Delete data from tree

func (*RTree) Insert

func (tr *RTree) Insert(min, max [2]float32, value interface{})

Insert inserts an item into the RTree

func (*RTree) Len

func (tr *RTree) Len() int

Len returns the number of items in tree

func (*RTree) Replace

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

Replace an item in the structure. This is effectively just a Delete followed by an Insert.

func (*RTree) Scan

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

Scan iterates through all data in tree.

func (*RTree) Search

func (tr *RTree) Search(
	min, max [2]float32,
	iter func(min, max [2]float32, value interface{}) bool,
)

Search ...

Jump to

Keyboard shortcuts

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