Class PointOctree<T>

An octree that manages points.

Type Parameters

  • T

    The type of the data.

Hierarchy

Constructors

  • Constructs a new point octree.

    Type Parameters

    • T

    Parameters

    • min: Vector3

      The lower bounds of the tree.

    • max: Vector3

      The upper bounds of the tree.

    • bias: number = 0.0

      An octant boundary bias. The octree is considered "loose" with a bias greater than 0.

    • maxPoints: number = 8

      The maximum amount of distinct points per leaf octant.

    • maxDepth: number = 8

      The maximum tree depth level, starting at 0.

    Returns PointOctree<T>

Properties

root: Node

The root octant.

Accessors

  • get children(): null | Node[]
  • The children of this node.

    Returns null | Node[]

Methods

  • Returns an iterator that traverses the octree and returns all leaf nodes.

    Returns Iterator<Node, any, undefined>

    An iterator.

  • Counts the points in the given octant.

    Parameters

    • octant: PointOctant<T> = ...

      An octant. Defaults to the root octant.

    Returns number

    The amount of points.

  • Finds the closest point to the given one.

    Parameters

    • point: Vector3

      A point.

    • maxDistance: number = Number.POSITIVE_INFINITY

      An upper limit for the distance between the points.

    • skipSelf: boolean = false

      Whether a point that is exactly at the given position should be skipped.

    Returns null | PointContainer<T>

    The nearest point, or null if there is none.

  • Finds points within a specific radius around a given point.

    Parameters

    • point: Vector3

      A position.

    • radius: number

      A radius.

    • skipSelf: boolean = false

      Whether a point that is exactly at the given position should be skipped.

    Returns PointContainer<T>[]

    A list of points.

  • Retrieves the data of the specified point.

    Parameters

    Returns null | T

    The data that belongs to the given point, or null if it doesn't exist.

  • Finds nodes that intersect with the given ray. The intersecting nodes are sorted by distance, closest first.

    Parameters

    Returns Node[]

    The intersecting nodes.

  • Returns the maximum tree depth.

    Returns number

    The maximum tree depth.

  • Returns the maximum amount of points per leaf octant.

    Returns number

    The maximum amount of points per leaf octant.

  • Returns an iterator that traverses the octree and returns leaf nodes.

    When a cull region is provided, the iterator will only return leaves that intersect with that region.

    Parameters

    Returns Iterator<Node, any, undefined>

    An iterator.

  • Moves an existing point to a new position. Has no effect if the point doesn't exist.

    Parameters

    Returns null | T

    The data of the updated point, or null if it didn't exist.

  • Removes a point from the tree.

    Parameters

    Returns null | T

    The data entry of the removed point or null if it didn't exist.

  • Inserts a point into the octree.

    If the point exists in the tree already, the data entry will be replaced.

    Parameters

    • point: Vector3

      The point.

    • data: T

      Data that belongs to the point.

    Returns boolean

    Whether the operation was successful.

Generated using TypeDoc