import { Box3, Matrix4 } from 'three'; import { CadNode } from '../wrappers/CadNode'; /** * An instance of this class is used to dynamically alter the sector bounding boxes to adapt to custom node transforms. * The bounding box of a sector is kept equal to its original value, unless: * - A node with geometry in the sector is transformed such that the original bounds would not fully contain the node geometry * - Descendants of the sector have grown, and are no longer contained within the original bounds. * The set of sectors a tree index has geometry in does not need to be known upfront. This set of sectors, and the node transform, * are set independently of each other. */ export declare class CustomSectorBounds { private readonly cadNode; private readonly _treeIndexToTransformedNodeMap; private readonly _sectorIdToTransformedNodesMap; private readonly _originalSectorBounds; private readonly _sectorsWithInvalidBounds; private readonly _allSectorsSortedByDepth; constructor(cadNode: CadNode); /** * Returns whether or not the given node is registered * @param treeIndex Tree index of the node to check * @returns True if node is registered, false otherwise */ isRegistered(treeIndex: number): boolean; /** * Registers a node as transformed, meaning it'll be taken into account when sector bounds are recomputed * @param treeIndex Tree index of the transformed node * @param originalBoundingBox The original bounding box of this node */ registerTransformedNode(treeIndex: number, originalBoundingBox?: Box3): void; /** * Updates the transform for a registered node. Sector bounds will not be changed until recomputeSectorBounds() is called * @param treeIndex Tree index of the transformed node * @param newTransform The transform */ updateNodeTransform(treeIndex: number, newTransform: Matrix4): void; /** * Updates the set of sectors a node is known to have geometry in. Addition of new sectors is the only possible operation. * Sector bounds will not be changed until recomputeSectorBounds() is called * @param treeIndex Tree index of the transformed node * @param newSectors The new sector(s) that this node is discovered to have geometry in */ updateNodeSectors(treeIndex: number, newSectors: number[]): void; /** * Unregisters a node, meaning it will no longer be taken into account when sector bounds are recomputed * @param treeIndex Tree index of the node to be unregistered */ unregisterTransformedNode(treeIndex: number): void; /** * Recomputes the sector bounds making all registered nodes fully contained in their respective sectors. This * is the only time the sector bounds are actually altered. */ recomputeSectorBounds(): void; /** * Sets the bounding box of a given sector by expanding the original bounds to include the given custom bounding boxes * @param sectorId The sector id * @param customBoundingBoxes An array of bounding boxes this sector should contain * @returns True if the new sector bounds are different from the original values. False otherwise */ private updateSector; private getOriginalSectorBounds; private setCustomSectorBounds; private clearCustomSectorBounds; private sectorMetadata; }