Skip to main content
Version: 4.x

Class: CameraManagerHelper

@cognite/reveal.CameraManagerHelper

Helper methods for implementing a camera manager.

Constructors

constructor

new CameraManagerHelper()

Methods

calculateCameraStateToFitBoundingBox

Static calculateCameraStateToFitBoundingBox(camera, box, radiusFactor?): Object

Calculates camera position and target that allows to see the content of provided bounding box.

Parameters

NameTypeDefault valueDescription
cameraPerspectiveCameraundefinedUsed camera instance.
boxBox3undefinedBounding box to be fitted.
radiusFactornumber2The ratio of the distance from camera to center of box and radius of the box.

Returns

Object

NameType
positionVector3
targetVector3

Defined in

packages/camera-manager/src/CameraManagerHelper.ts:110


calculateNewRotationFromTarget

Static calculateNewRotationFromTarget(camera, newTarget): Quaternion

Calculates camera rotation from target

Parameters

NameTypeDescription
cameraPerspectiveCameraUsed Camera instance
newTargetVector3The target to compute rotation from

Returns

Quaternion

New camera rotationg

Defined in

packages/camera-manager/src/CameraManagerHelper.ts:68


calculateNewTargetFromRotation

Static calculateNewTargetFromRotation(camera, rotation, currentTarget): Vector3

Calculates camera target based on new camera rotation.

Parameters

NameTypeDescription
cameraPerspectiveCameraUsed camera instance.
rotationQuaternionNew camera rotation in quaternion form.
currentTargetVector3Current camera target.

Returns

Vector3

Defined in

packages/camera-manager/src/CameraManagerHelper.ts:42


updateCameraNearAndFar

Static updateCameraNearAndFar(camera, combinedBbox): void

Updates near and far plane of the camera based on the bounding box.

Parameters

NameTypeDescription
cameraPerspectiveCameraUsed camera instance.
combinedBboxBox3Bounding box of all objects on the scene.

Returns

void

Defined in

packages/camera-manager/src/CameraManagerHelper.ts:79