import { Raycaster, Vector3 } from "three"; import { Octree } from "../core/Octree.js"; import { PointContainer } from "./PointContainer.js"; import { PointOctant } from "./PointOctant.js"; import { RayPointIntersection } from "./RayPointIntersection.js"; /** * An octree that manages points. * * @param T - The type of the data. */ export declare class PointOctree extends Octree { /** * An octant boundary bias. */ private bias; /** * The number of points per octant before a split occurs. * * This value works together with the maximum depth as a secondary limiting factor. Smaller values cause splits to * occur earlier which results in a faster and deeper tree growth. */ private maxPoints; /** * The maximum tree depth level. * * Infinity is a valid value, but allowing infinitely small octants can result in poor performance. */ private maxDepth; /** * Constructs a new point octree. * * @param min - The lower bounds of the tree. * @param max - The upper bounds of the tree. * @param bias - An octant boundary bias. The octree is considered "loose" with a bias greater than 0. * @param maxPoints - The maximum amount of distinct points per leaf octant. * @param maxDepth - The maximum tree depth level, starting at 0. */ constructor(min: Vector3, max: Vector3, bias?: number, maxPoints?: number, maxDepth?: number); /** * Returns the octree bias. * * @return The bias. */ getBias(): number; /** * Returns the maximum amount of points per leaf octant. * * @return The maximum amount of points per leaf octant. */ getMaxPoints(): number; /** * Returns the maximum tree depth. * * @return The maximum tree depth. */ getMaxDepth(): number; /** * Counts the points in the given octant. * * @param octant - An octant. Defaults to the root octant. * @return The amount of points. */ countPoints(octant?: PointOctant): number; /** * Inserts a point into the octree. * * If the point exists in the tree already, the data entry will be replaced. * * @param point - The point. * @param data - Data that belongs to the point. * @return Whether the operation was successful. */ set(point: Vector3, data: T): boolean; /** * Removes a point from the tree. * * @param point - The point. * @return The data entry of the removed point or null if it didn't exist. */ remove(point: Vector3): T | null; /** * Retrieves the data of the specified point. * * @param point - A position. * @return The data that belongs to the given point, or null if it doesn't exist. */ get(point: Vector3): T | null; /** * Moves an existing point to a new position. Has no effect if the point doesn't exist. * * @param point - The point. * @param position - The new position. * @return The data of the updated point, or null if it didn't exist. */ move(point: Vector3, position: Vector3): T | null; /** * Finds the closest point to the given one. * * @param point - A point. * @param maxDistance - An upper limit for the distance between the points. * @param skipSelf - Whether a point that is exactly at the given position should be skipped. * @return The nearest point, or null if there is none. */ findNearestPoint(point: Vector3, maxDistance?: number, skipSelf?: boolean): PointContainer | null; /** * Finds points within a specific radius around a given point. * * @param point - A position. * @param radius - A radius. * @param skipSelf - Whether a point that is exactly at the given position should be skipped. * @return A list of points. */ findPoints(point: Vector3, radius: number, skipSelf?: boolean): PointContainer[]; /** * Finds the points that intersect with the given ray. * * @param raycaster - The raycaster. * @return The intersecting points. */ raycast(raycaster: Raycaster): RayPointIntersection[]; }