Skip to content

tidwall/qtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QTree

GoDoc

This package provides an in-memory quadtree implementation for Go.

Cities

Usage

Installing

To start using QTree, install Go and run go get:

$ go get -u github.com/tidwall/qtree

Basic operations

// create a QTree
var tr qtree.QTree

// insert a point
tr.Insert([2]float64{-112.0078, 33.4373}, [2]float64{-112.0078, 33.4373}, "PHX")

// insert a box
tr.Insert([2]float64{10, 10}, [2]float64{20, 20}, "rect")

// search 
tr.Search([2]float64{-112.1, 33.4}, [2]float64{-112.0, 33.5}, 
 	func(min, max [2]float64, value interface{}) bool {
		println(value.(string)) // prints "PHX"
	},
)

// delete 
tr.Delete([2]float64{-112.0078, 33.4373}, [2]float64{-112.0078, 33.4373}, "PHX")

Performance

Pretty, pretty, pretty good.

License

qtree source code is available under the MIT License.

About

jeez it's just a quadtree chill out

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages