import { Box3, Matrix4, Sphere, Vector3, Object3D } from 'three/webgpu'; /** * The box that encloses a set of objects. * * A measurement and nothing else: no place in the scene graph, no owner, no * visualisation. {@link BoundingBoxComponent} is what gives a node one of these * and keeps it current; anything that just needs the numbers builds one here. * * Two shapes: * * - {@link enclose} is axis-aligned in world space. What camera framing wants, * and what `size` means for a whole scene. * - {@link encloseOriented} is axis-aligned in a frame that carries another * object's position and rotation but not its scale. The box hugs a turned * object instead of enclosing its world projection, and `size` becomes the * object's own width, height and depth in world units. A 2 x 1 x 1 object * turned 45 degrees measures 2 x 1 x 1 oriented and 2.121 x 1 x 2.121 * world-aligned. * * `center` and `sphere` are in world space either way, so code that frames a * camera never has to ask which shape it was handed. Only `box` and `size` live * in the measured frame, and {@link frame} is how they get to the world. * * Reused rather than rebuilt: enclosing again overwrites what is there, so a * caller that measures repeatedly allocates once. * * Only geometry that {@link computeProductBounds} counts as real is measured, so * helpers, the ground plane and gizmo handles never widen a box. * * @module */ export declare class BoundingBox { readonly isBoundingBox: true; private _box; private _sphere; private _center; private _size; private _frame; private _oriented; /** The box itself, in the frame it was measured in. */ get box(): Box3; /** Width, height and depth, in the frame the box was measured in. */ get size(): Vector3; /** The centre of the box, in world space. */ get center(): Vector3; /** The sphere around the box, in world space. */ get sphere(): Sphere; /** The radius of that sphere. */ get radius(): number; /** How the measured frame relates to the world. Identity when world-aligned. */ get frame(): Matrix4; /** Whether anything was found to measure. */ get isEmpty(): boolean; /** * Measures a world-aligned box around everything given. * * @param objects - What to enclose, with everything below it. */ enclose(objects: Object3D | readonly Object3D[]): this; /** * Measures a box aligned to another object's axes. * * @param objects - What to enclose, with everything below it. * @param frame - Whose axes to align to. Its position and rotation are taken, * its scale is not: the scale belongs in the extents, or `size` would report * the geometry's own numbers rather than the size in the scene. */ encloseOriented(objects: Object3D | readonly Object3D[], frame: Object3D): this; /** Empties the box, for when there is nothing to measure. */ clear(): this; private _measure; /** Turns the measured box into the world-space figures. */ private _derive; /** The distance from the world centre to the furthest corner. */ private _worldRadius; }