Class: CameraManagerHelper
@cognite/reveal.CameraManagerHelper
Helper methods for implementing a camera manager.
Constructors
constructor
• new CameraManagerHelper(): CameraManagerHelper
Returns
Methods
calculateCameraStateToFitBoundingBox
▸ calculateCameraStateToFitBoundingBox(camera
, boundingBox
, radiusFactor?
): Object
Calculates camera position and target that allows to see the content of provided bounding box.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
camera | PerspectiveCamera | undefined | Used camera instance. |
boundingBox | Box3 | undefined | Bounding box to be fitted. |
radiusFactor | number | 2 | The ratio of the distance from camera to center of box and radius of the box. |
Returns
Object
Name | Type |
---|---|
position | Vector3 |
target | Vector3 |
Defined in
packages/camera-manager/src/CameraManagerHelper.ts:111
calculateNewRotationFromTarget
▸ calculateNewRotationFromTarget(camera
, newTarget
): Quaternion
Calculates camera rotation from target
Parameters
Name | Type | Description |
---|---|---|
camera | PerspectiveCamera | Used Camera instance |
newTarget | Vector3 | The target to compute rotation from |
Returns
Quaternion
New camera rotationg
Defined in
packages/camera-manager/src/CameraManagerHelper.ts:70
calculateNewTargetFromRotation
▸ calculateNewTargetFromRotation(camera
, rotation
, currentTarget
, position
): Vector3
Calculates camera target based on new camera rotation.
Parameters
Name | Type | Description |
---|---|---|
camera | PerspectiveCamera | Used camera instance. |
rotation | Quaternion | New camera rotation in quaternion form. |
currentTarget | Vector3 | Current camera target. |
position | Vector3 | New camera position. |
Returns
Vector3
Defined in
packages/camera-manager/src/CameraManagerHelper.ts:43
updateCameraNearAndFar
▸ updateCameraNearAndFar(camera
, boundingBox
): void
Updates near and far plane of the camera based on the bounding box.
Parameters
Name | Type | Description |
---|---|---|
camera | PerspectiveCamera | Used camera instance. |
boundingBox | Box3 | Bounding box of all objects on the scene. |
Returns
void