Reference Source
public class | source

ObjectsKdTree3

Automatically indexes a Viewer's Entitys in a 3D k-d tree to support fast collision detection with 3D World-space axis-aligned boundaries (AABBs) and frustums.

See MarqueePicker for usage example.

An ObjectsKdTree3 is configured with a Viewer, and will then automatically keep itself populated with k-d nodes that contain the Viewer's Entitys.

We can then traverse the k-d nodes, starting at ObjectsKdTree3#root, to find the contained Entities.

Constructor Summary

Public Constructor
public

constructor(cfg: *)

Creates an ObjectsKdTree3.

Member Summary

Public Members
public get

root: *

Gets the root ObjectsKdTree3 node.

public

viewer: *

Method Summary

Public Methods
public

Destroys this ObjectsKdTree3.

Public Constructors

public constructor(cfg: *) source

Creates an ObjectsKdTree3.

Params:

NameTypeAttributeDescription
cfg *

Configuration

cfg.viewer Viewer

The Viewer that provides the Entitys in this ObjectsKdTree3.

cfg.maxTreeDepth number
  • optional
  • default: 15

Optional maximum depth for the k-d tree.

Public Members

public get root: * source

Gets the root ObjectsKdTree3 node.

Each time this accessor is accessed, it will lazy-rebuild the ObjectsKdTree3 if Entitys have been created or removed in the Viewer since the last time it was accessed.

public viewer: * source

Public Methods

public destroy() source

Destroys this ObjectsKdTree3.

Does not destroy the Viewer given to the constructor of the ObjectsKdTree3.