sparse-octree - v7.2.0
    Preparing search index...

    Class PointOctree<T>

    An octree that manages points.

    Type Parameters

    • T = unknown

      The type of the data.

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructs a new point octree.

      Type Parameters

      • T = unknown

        The type of the data.

      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

    The root octant.

    Accessors

    • get children(): T[] | null

      The children of this node.

      Returns T[] | null

    Methods

    • 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 PointContainer<T> | null

      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 T | null

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

    • 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.

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

      Parameters

      Returns T | null

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

    • Removes a point from the tree.

      Parameters

      Returns T | null

      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.