Camera

class Communicator.Camera()

Object representing a viewpoint from which the scene can be rendered. More information about using Camera can be found here.


Methods

copy

Camera.copy()

Creates a copy of the camera.

Return type

Camera()

Returns

new object initialized with the current values of this camera

dolly

Camera.dolly(delta)

Move the camera along a delta

Arguments
Return type

void

equals

Camera.equals(cam)

Returns checks for equality with another camera

Arguments
  • cam (Camera()) – the camera to compare against

Return type

boolean

equalsWithTolerance

Camera.equalsWithTolerance(cam, tolerance)

Returns checks for equality with another camera with tolerance

Arguments
  • cam (Camera()) – the camera to compare against

  • tolerance (number()) – floating point tolerance

Return type

boolean

forJson

Camera.forJson()
Deprecated

Use toJson instead.

Return type

Object

getCameraPlaneIntersectionPoint

Camera.getCameraPlaneIntersectionPoint(point, view)

Finds the intersection point with the camera plane

Arguments
Return type

Point3() | null

getFullMatrix

Camera.getFullMatrix(viewer)

Returns the camera’s projection matrix multiplied by its view matrix.

Arguments
  • viewer (WebViewer()) – The WebViewer for which the matrix should be valid.

Return type

Matrix()

getHeight

Camera.getHeight()

gets the camera height

Return type

number

Returns

the camera width

getMatrixFromCamera

Camera.getMatrixFromCamera()

Returns the transpose of the camera’s view matrix without the translation component and with the x- and z- axes flipped. See getViewMatrix

Deprecated

Return type

Matrix()

getNearLimit

Camera.getNearLimit()

gets the camera near clipping limit

Return type

number

Returns

the camera near clipping limit

getPosition

Camera.getPosition()

gets the camera position

Return type

Point3()

Returns

the camera position

getProjection

Camera.getProjection()

gets the camera projection

Return type

Projection

Returns

the camera projection

getProjectionMatrix

Camera.getProjectionMatrix(viewer)

Returns the camera’s projection matrix.

Arguments
  • viewer (WebViewer()) – The WebViewer for which the matrix should be valid.

Return type

Matrix()

getTarget

Camera.getTarget()

gets the camera target

Return type

Point3()

Returns

the camera target

getUp

Camera.getUp()

gets the camera up vector

Return type

Point3()

Returns

the camera up vector

getViewMatrix

Camera.getViewMatrix(viewer)

Returns the camera’s view matrix. This matrix places the camera at <0,0,0>, with the negative z-axis pointing toward the camera’s target and the y-axis in the direction of the camera’s up-vector.

Arguments
  • viewer (WebViewer()) – The WebViewer for which the matrix should be valid.

Return type

Matrix()

getWidth

Camera.getWidth()

gets the camera width

Return type

number

Returns

the camera width

setHeight

Camera.setHeight(height)

Sets the camera height

Arguments
  • height (number()) – the new camera height

Return type

void

setNearLimit

Camera.setNearLimit(nearLimit)

Sets the camera near clipping limit

Arguments
  • nearLimit (number()) – the new camera near clipping limit

Return type

void

setPosition

Camera.setPosition(position)

Sets the camera position

Arguments
  • position (Point3()) – the new camera position

Return type

void

setProjection

Camera.setProjection(projection)

Sets the camera projection

Arguments
  • projection (Projection) – the new camera Projection

Return type

void

setTarget

Camera.setTarget(target)

Sets the camera target

Arguments
  • target (Point3()) – the new camera target

Return type

void

setUp

Camera.setUp(up)

Sets the camera up vector

Arguments
  • up (Point3()) – the new camera up vector

Return type

void

setWidth

Camera.setWidth(width)

Sets the camera width

Arguments
  • width (number()) – the new camera width

Return type

void

toJson

Camera.toJson()

Creates an object ready for JSON serialization.

Return type

Object

Returns

The prepared object.

transform

Camera.transform(matrix)
Arguments
Return type

Camera()

static construct

Camera.construct(obj)
Deprecated

Use fromJson instead.

Arguments
  • obj (any()) –

Return type

Camera()

static create

Camera.create(pos, tar, up, projection, width, height[, nearLimit])

Creates a new camera object with the given parameters.

Arguments
  • pos (Point3()) – the camera position.

  • tar (Point3()) – the camera target.

  • up (Point3()) – the camera up vector.

  • projection (Projection) – the camera projection mode.

  • width (number()) – camea view width.

  • height (number()) – camera view height.

  • nearLimit (number()) – optional the camera near limit.

Return type

Camera()

Returns

a new camera object.

static fromJson

Camera.fromJson(objData)

Creates a new Camera from an object given by toJson

Arguments
  • objData (any()) – An object given by toJson

Return type

Camera()

Returns

The prepared object.