Documentation ¶
Overview ¶
Via https://github.com/JamesLMilner/quadtree-go Converted to ints for our use case
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bounds ¶
type Bounds struct {
X, Y, Width, Height int
Value interface{}
}
Bounds - A bounding box with a x,y origin and width and height
func (*Bounds) Intersects ¶
Intersects - Checks if a Bounds object intersects with another Bounds
type Quadtree ¶
type Quadtree struct { Bounds Bounds MaxObjects int // Maximum objects a node can hold before splitting into 4 subnodes MaxLevels int // Total max levels inside root Quadtree Level int // Depth level, required for subnodes Objects []Bounds Nodes []Quadtree Total int }
Quadtree - The quadtree data structure
func (*Quadtree) Insert ¶
Insert - Insert the object into the node. If the node exceeds the capacity, it will split and add all objects to their corresponding subnodes.
func (*Quadtree) RetrieveIntersections ¶
RetrieveIntersections - Bring back all the bounds in a Quadtree that intersect with a provided bounds
func (*Quadtree) RetrievePoints ¶
RetrievePoints - Return all points that collide
func (*Quadtree) TotalNodes ¶
TotalNodes - Retrieve the total number of sub-Quadtrees in a Quadtree
Click to show internal directories.
Click to hide internal directories.