Documentation
¶
Index ¶
- Constants
- type Entity
- type Moveable
- type RTree
- func (r *RTree) Collision(obj shapes.Spatial, filter func(spatial shapes.Spatial) bool) (objects []shapes.Spatial)
- func (r *RTree) Delete(obj shapes.Spatial) bool
- func (r *RTree) Depth() int
- func (r *RTree) GetAllBoundingBoxes() []shapes.Box
- func (r *RTree) Insert(obj shapes.Spatial)
- func (r *RTree) MoveObject(obj Moveable, v shapes.Point)
- func (r *RTree) NearestNeighbor(p shapes.Point, filter func(spatial shapes.Spatial) bool) (shapes.Spatial, float64)
- func (r *RTree) NearestNeighbors(k int, p shapes.Point, maxDistance float64, ...) ([]shapes.Spatial, []float64)
- func (r *RTree) SearchIntersect(bb shapes.Box, filter func(spatial shapes.Spatial) bool) []shapes.Spatial
- func (r *RTree) Size() int
- func (r *RTree) Update(obj shapes.Spatial)
Constants ¶
const ( DefaultMinRTreeOption = 25 DefaultMaxRTreeOption = 50 )
RTree options
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RTree ¶
RTree represents an R-tree, a balanced search tree for storing and querying shapes.Spatial objects
func NewRTree ¶
NewRTree returns an RTree. If the number of objects given on initialization is larger than max, the RTree will be initialized using the Overlap Minimizing Top-down bulk-loading algorithm.
func (*RTree) Collision ¶
func (r *RTree) Collision(obj shapes.Spatial, filter func(spatial shapes.Spatial) bool) (objects []shapes.Spatial)
Collision check shapes.Spatial object on collisions
func (*RTree) GetAllBoundingBoxes ¶
GetAllBoundingBoxes returning slice of bounding boxes by traversing tree.
func (*RTree) Insert ¶
Insert implemented per Section 3.2 of "R-trees: A Dynamic Index Structure for shapes.Spatial Searching" by A. Guttman, Proceedings of ACM SIGMOD, p. 47-57, 1984.
func (*RTree) MoveObject ¶
MoveObject move object
func (*RTree) NearestNeighbor ¶
func (r *RTree) NearestNeighbor(p shapes.Point, filter func(spatial shapes.Spatial) bool) (shapes.Spatial, float64)
NearestNeighbor returns the closest object to the specified point
func (*RTree) NearestNeighbors ¶
func (r *RTree) NearestNeighbors(k int, p shapes.Point, maxDistance float64, filter func(spatial shapes.Spatial) bool, ) ([]shapes.Spatial, []float64)
NearestNeighbors gets the closest Spatials to the Point.
func (*RTree) SearchIntersect ¶
func (r *RTree) SearchIntersect(bb shapes.Box, filter func(spatial shapes.Spatial) bool) []shapes.Spatial
SearchIntersect returns all objects that intersect the specified rectangle.