Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KDTree

since

0.3.5

Hierarchy

  • KDTree

Index

Constructors

constructor

  • new KDTree(agents: Agent[], dimension?: number, depth?: number, bbox?: BBox): KDTree

Properties

agents

agents: Agent[] = null

bbox

bbox: BBox

depth

depth: number = 0

dimension

dimension: number = 2

left

left: KDTree = null

median

median: number = null

needsUpdating

needsUpdating: boolean = false

parent

parent: KDTree = null

right

right: KDTree = null

Methods

agentsWithinDistance

  • agentsWithinDistance(pt: Agent | Point, d: number): Agent[]
  • Return all the Agents in this KDTree that are within d distance of the given Point or Agent pt.

    since

    0.3.5

    Parameters

    • pt: Agent | Point
    • d: number

    Returns Agent[]

axis

  • axis(): "x" | "y" | "z"

intersectsAlongDimension

  • intersectsAlongDimension(pt: Agent | Point, d: number, coord: "x" | "y" | "z"): boolean

locateSubtree

nearestNeighbor

  • Returns the Agent in this KDTree that is closest spatially to the given Point or Agent pt.

    since

    0.3.5

    Parameters

    Returns Agent

rebalance

  • rebalance(agents?: Agent[]): void
  • Rebalance the KDTree (if it has been marked as needing updating). Optionally pass the agents that belong to this tree (relevant for trees of higher depth than the top level).

    since

    0.3.5

    Parameters

    Returns void

removeAgent

  • removeAgent(agent: Agent, rebalance?: boolean): boolean

sphereIntersectsBBox

  • sphereIntersectsBBox(pt: Agent | Point, d: number): boolean

subtreesWithinDistance

Generated using TypeDoc