quadtree

package
v6.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataT

type DataT struct {
	Lat float64 // top
	Lon float64 // left
	Obj ObjT
}

type Node

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

type ObjT

type ObjT tc.CacheGroupName

type Quadtree

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

func New

func New() *Quadtree

Create Returns a latitude-longitude Quadtree Note this creates a latlon quadtree. In Lat Lon, right > left and top > bottom TODO add CreateAndInsert func, for optimisation?

func (*Quadtree) Get

func (q *Quadtree) Get(top float64, left float64, bottom float64, right float64) []DataT

func (*Quadtree) Insert

func (q *Quadtree) Insert(d DataT)

Insert inserts the given data into the quadtree

func (*Quadtree) Nearest

func (q *Quadtree) Nearest(top float64, left float64) (DataT, bool)

Nearest returns the nearest object to the given coordinates, and whether an element was found. Returns false iff the tree is empty. TODO add NearestN - n nearest objs, e.g. in case no cache in the nearest cachegroup is available. TODO add NearestAll - all nearest objs with the same coords, e.g. so multiple cachegroups at the same coordinate can be round-robined

Jump to

Keyboard shortcuts

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