Skip to main content
Version: 3.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:97


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:66