BoundingBoxer
An implementation of bounding box utilities that works for fragments. 📕 Tutorial. 📘 API.
Extends
Implements
Properties
enabled
enabled:
boolean
=true
Overrides
list
readonly
list:DataSet
<Box3
>
A readonly dataset containing instances of THREE.Box3.
onDisposed
readonly
onDisposed:Event
<unknown
>
Implementation of
Methods
addFromModelIdMap()
addFromModelIdMap(
items
):Promise
<void
>
Asynchronously adds bounding boxes to the list by merging boxes from models
specified in the provided ModelIdMap
.
Parameters
Parameter | Type | Description |
---|---|---|
items | ModelIdMap | 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
Parameter | Type | Description |
---|---|---|
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
Parameters
Parameter | Type | Default value |
---|---|---|
full | boolean | true |
Returns
void
Implementation of
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
Parameter | Type | Default value | Description |
---|---|---|---|
orientation | "front" | "back" | "left" | "right" | "top" | "bottom" | undefined | Specifies the direction of the camera relative to the bounding box. |
offsetFactor | number | 1 | A multiplier applied to the distance between the camera and the bounding box. Defaults to |
Returns
Promise
<object
>
An object containing:
position
: ATHREE.Vector3
representing the calculated camera position.target
: ATHREE.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
Parameter | Type | Description |
---|---|---|
modelIdMap | ModelIdMap | A 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
isDisposeable()
isDisposeable():
this is Disposable
Whether is component is Disposable.
Returns
this is Disposable
Inherited from
isHideable()
isHideable():
this is Hideable
Whether is component is Hideable.
Returns
this is Hideable
Inherited from
isResizeable()
isResizeable():
this is Resizeable
Whether is component is Resizeable.
Returns
this is Resizeable
Inherited from
isUpdateable()
isUpdateable():
this is Updateable
Whether is component is Updateable.
Returns
this is Updateable