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

Communicator.Camera.copy()

Creates a copy of the camera.

Return type

Communicator.Camera

Returns

new object initialized with the current values of this camera

dolly

Communicator.Camera.dolly(delta)

Move the camera along a delta

Arguments
Return type

void

equals

Communicator.Camera.equals(cam)

Returns checks for equality with another camera

Arguments
Return type

boolean

equalsWithTolerance

Communicator.Camera.equalsWithTolerance(cam, tolerance)

Returns checks for equality with another camera with tolerance

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

  • tolerance (number()) – floating point tolerance

Return type

boolean

forJson

Communicator.Camera.forJson()

Note

forJson is deprecated: Use toJson instead.

Return type

Object

getCameraPlaneIntersectionPoint

Communicator.Camera.getCameraPlaneIntersectionPoint(point, view)

Finds the intersection point with the camera plane

Arguments
Return type

{  }

getFullMatrix

Communicator.Camera.getFullMatrix(viewer)

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

Arguments
Return type

Communicator.Matrix

getHeight

Communicator.Camera.getHeight()

gets the camera height

Return type

number

Returns

the camera width

getMatrixFromCamera

Communicator.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

Note

getMatrixFromCamera is deprecated

Return type

Communicator.Matrix

getNearLimit

Communicator.Camera.getNearLimit()

gets the camera near clipping limit

Return type

number

Returns

the camera near clipping limit

getPosition

Communicator.Camera.getPosition()

gets the camera position

Return type

Communicator.Point3

Returns

the camera position

getProjection

Communicator.Camera.getProjection()

gets the camera projection

Return type

Communicator.Projection

Returns

the camera projection

getProjectionMatrix

Communicator.Camera.getProjectionMatrix(viewer)

Returns the camera’s projection matrix.

Arguments
Return type

Communicator.Matrix

getTarget

Communicator.Camera.getTarget()

gets the camera target

Return type

Communicator.Point3

Returns

the camera target

getUp

Communicator.Camera.getUp()

gets the camera up vector

Return type

Communicator.Point3

Returns

the camera up vector

getViewMatrix

Communicator.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
Return type

Communicator.Matrix

getWidth

Communicator.Camera.getWidth()

gets the camera width

Return type

number

Returns

the camera width

setHeight

Communicator.Camera.setHeight(height)

Sets the camera height

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

Return type

void

setNearLimit

Communicator.Camera.setNearLimit(nearLimit)

Sets the camera near clipping limit

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

Return type

void

setPosition

Communicator.Camera.setPosition(position)

Sets the camera position

Arguments
Return type

void

setProjection

Communicator.Camera.setProjection(projection)

Sets the camera projection

Arguments
  • projection (Communicator.Projection()) – the new camera Projection

Return type

void

setTarget

Communicator.Camera.setTarget(target)

Sets the camera target

Arguments
Return type

void

setUp

Communicator.Camera.setUp(up)

Sets the camera up vector

Arguments
Return type

void

setWidth

Communicator.Camera.setWidth(width)

Sets the camera width

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

Return type

void

toJson

Communicator.Camera.toJson()

Creates an object ready for JSON serialization.

Return type

Object

Returns

The prepared object.

transform

Communicator.Camera.transform(matrix)
Arguments
Return type

Communicator.Camera

construct

Communicator.Camera.construct(obj)

Note

construct is deprecated: Use fromJson instead.

Arguments
  • obj (any()) –

Return type

Communicator.Camera

create

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

Creates a new camera object with the given parameters.

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

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

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

  • projection (Communicator.Projection()) – the camera projection mode.

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

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

  • nearLimit ({  }()) – the camera near limit.

Return type

Communicator.Camera

Returns

a new camera object.

fromJson

Communicator.Camera.fromJson(objData)

Creates a new Camera from an object given by toJson

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

Return type

Communicator.Camera

Returns

The prepared object.