Utilities for computing and managing Axis-Aligned Bounding Boxes (AABB) in xeokit scenes.
The Scene AABB3 Index provides fast, centralized access to bounding boxes for
entire scenes, individual objects, and meshes. It keeps these bounds up to date
as the scene changes, making it useful for view framing, spatial queries, and
scene analysis.
xeokit Scene AABB3 Index
Utilities for computing and managing Axis-Aligned Bounding Boxes (AABB) in xeokit scenes.
The Scene AABB3 Index provides fast, centralized access to bounding boxes for entire scenes, individual objects, and meshes. It keeps these bounds up to date as the scene changes, making it useful for view framing, spatial queries, and scene analysis.
Features
Installation
Usage
This section walks through creating a scene, populating it with geometry, and querying bounding boxes using the Scene AABB3 Index.
Step 1: Import required modules
Import the Scene API, the AABB index helpers, and any constants needed to define geometry.
Step 2: Create a Scene and SceneModel
Create a new Scene, then create a SceneModel to hold geometry and objects.
Step 3: Define geometry and meshes
Create geometry, attach it to a mesh, and then reference that mesh from a SceneObject.
Step 4: Create or retrieve the SceneAABB3Index
Obtain a SceneAABB3Index for the Scene. If one already exists, it will be reused automatically.
Step 5: Query scene-level bounds
Retrieve the axis-aligned bounding box for the entire Scene, as well as its center point.
Step 6: Query object-level bounds
Get the AABB for a single SceneObject by ID.
You can also compute a combined bounding box for multiple objects.
Step 7: Clean up
When the index is no longer needed, destroy it explicitly. The index will also be destroyed automatically when the Scene itself is destroyed.