Skip to main content

BoundingBoxer

An implementation of bounding box utilities that works for fragments. 📕 Tutorial. 📘 API.

Extends

Implements

Properties

enabled

enabled: boolean = true

Component.enabled

Overrides

Component . enabled


list

readonly list: DataSet<Box3>

A readonly dataset containing instances of THREE.Box3.


onDisposed

readonly onDisposed: Event<unknown>

Disposable.onDisposed

Implementation of

Disposable . onDisposed

Methods

addFromModelIdMap()

addFromModelIdMap(items): Promise<void>

Asynchronously adds bounding boxes to the list by merging boxes from models specified in the provided ModelIdMap.

Parameters

ParameterTypeDescription
itemsModelIdMap

A map where keys are model IDs and values are arrays of local IDs

representing specific parts of the models to include in the bounding box.

Returns

Promise<void>


addFromModels()

addFromModels(modelIds?): void

Adds bounding boxes from models to the current list based on optional filtering criteria.

Parameters

ParameterTypeDescription
modelIds?RegExp[]

An optional array of regular expressions used to filter models by their IDs.

If provided, only models whose IDs match at least one of the regular expressions

will have their bounding boxes added to the list. If not, all models will be used.

Returns

void


dispose()

dispose(full): void

Disposable.dispose

Parameters

ParameterTypeDefault value
fullbooleantrue

Returns

void

Implementation of

Disposable . dispose


get()

get(): Box3

Combines all bounding boxes in the list property into a single bounding box.

Returns

Box3

A THREE.Box3 instance representing the union of all bounding boxes in the list.


getCameraOrientation()

getCameraOrientation(orientation, offsetFactor): Promise<object>

Calculates the camera orientation and position based on the specified orientation and an optional offset factor.

Parameters

ParameterTypeDefault valueDescription
orientation"front" | "back" | "left" | "right" | "top" | "bottom"undefinedSpecifies the direction of the camera relative to the bounding box.
offsetFactornumber1

A multiplier applied to the distance between the camera and the bounding box.

Defaults to 1.

Returns

Promise<object>

An object containing:

  • position: A THREE.Vector3 representing the calculated camera position.
  • target: A THREE.Vector3 representing the center of the bounding box, which the camera should target.
position

position: Vector3

target

target: Vector3 = center


getCenter()

getCenter(modelIdMap): Promise<Vector3>

Calculates and returns the center point of the bounding box derived from the provided model ID map.

Parameters

ParameterTypeDescription
modelIdMapModelIdMapA mapping of model IDs and localIds used to generate the bounding box.

Returns

Promise<Vector3>

A THREE.Vector3 object representing the center point of the bounding box.


isConfigurable()

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns

this is Configurable<any, any>

Inherited from

Component . isConfigurable


isDisposeable()

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns

this is Disposable

Inherited from

Component . isDisposeable


isHideable()

isHideable(): this is Hideable

Whether is component is Hideable.

Returns

this is Hideable

Inherited from

Component . isHideable


isResizeable()

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns

this is Resizeable

Inherited from

Component . isResizeable


isUpdateable()

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns

this is Updateable

Inherited from

Component . isUpdateable