Skip to main content

QuadTree <TItem>

QuadTree spatial data structure. Useful for quickly retrieving all objects that might be in a specific location.

Index

Constructors

constructor

Properties

publicbottomLeft

bottomLeft: QuadTree<TItem> = null

publicbottomRight

bottomRight: QuadTree<TItem> = null

publicbounds

bounds: BoundingBox

publichalfHeight

halfHeight: number

publichalfWidth

halfWidth: number

publicitems

items: TItem[] = []

publicoptionaloptions

options?: QuadTreeOptions

publictopLeft

topLeft: QuadTree<TItem> = null

publictopRight

topRight: QuadTree<TItem> = null

Methods

clear

  • clear(): void
  • Returns void

debug

getAllItems

  • getAllItems(): TItem[]
  • Returns TItem[]

getTreeDepth

  • getTreeDepth(): number
  • Returns number

insert

  • insert(item: TItem): void
  • Insert an item to be tracked in the QuadTree


    Parameters

    • item: TItem

    Returns void

query

  • Query the structure for all objects that intersect the bounding box


    Parameters

    Returns TItem[]

    items

remove

  • remove(item: TItem): void
  • Remove a tracked item in the QuadTree


    Parameters

    • item: TItem

    Returns void