Camera

class Camera()

Object representing a viewpoint from which the scene can be rendered. More information about using Camera can be found [here](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/scene_attributes/camera.html).

Constructors


Constructors

Camera.constructor()
Return type:Camera

Methods

copy

Camera.copy()

Creates a copy of the camera.

Returns:new object initialized with the current values of this camera
Return type:Camera

dolly

Camera.dolly(delta)
Arguments:

Move the camera along a delta

Return type:void

equals

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

Returns checks for equality with another camera

Return type:boolean

equalsWithTolerance

Camera.equalsWithTolerance(cam, tolerance)
Arguments:
  • cam (Camera()) – the camera to compare against
  • tolerance (number()) – floating point tolerance

Returns checks for equality with another camera with tolerance

Return type:boolean

getCameraPlaneIntersectionPoint

Camera.getCameraPlaneIntersectionPoint(point, view)
Arguments:
  • point (Point2()) – None
  • view (IView()) – None

Finds the intersection point with the camera plane

Return type:null | Point3

getFullMatrix

Camera.getFullMatrix(viewer[, view])
Arguments:
  • viewer (IWebViewer()) – The [[WebViewer]] for which the matrix should be valid.
  • view (IView()) – optional the [[View]] to use when calculating projection effects. Uses default view if undefined

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

Return type:Matrix

getHeight

Camera.getHeight()

gets the camera height

Returns:the camera width
Return type:number

getNearLimit

Camera.getNearLimit()

gets the camera near clipping limit

Returns:the camera near clipping limit
Return type:number

getPosition

Camera.getPosition()

gets the camera position

Returns:the camera position
Return type:Point3

getProjection

Camera.getProjection()

gets the camera projection

Returns:the camera projection
Return type:Projection

getProjectionMatrix

Camera.getProjectionMatrix(viewer[, view])
Arguments:
  • viewer (IWebViewer()) – The [[WebViewer]] for which the matrix should be valid.
  • view (IView()) – optional the [[View]] to use when calculating projection effects. Uses default view if undefined

Returns the camera’s projection matrix.

Return type:Matrix

getTarget

Camera.getTarget()

gets the camera target

Returns:the camera target
Return type:Point3

getUp

Camera.getUp()

gets the camera up vector

Returns:the camera up vector
Return type:Point3

getViewMatrix

Camera.getViewMatrix(viewer)
Arguments:
  • viewer (IWebViewer()) – The [[WebViewer]] for which the matrix should be valid.

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.

Return type:Matrix

getWidth

Camera.getWidth()

gets the camera width

Returns:the camera width
Return type:number

setHeight

Camera.setHeight(height)
Arguments:
  • height (number()) – the new camera height

Sets the camera height

Return type:void

setNearLimit

Camera.setNearLimit(nearLimit)
Arguments:
  • nearLimit (number()) – the new camera near clipping limit

Sets the camera near clipping limit

Return type:void

setPosition

Camera.setPosition(position)
Arguments:
  • position (Point3()) – the new camera position

Sets the camera position

Return type:void

setProjection

Camera.setProjection(projection)
Arguments:
  • projection (Projection()) – the new camera Projection

Sets the camera projection

Return type:void

setTarget

Camera.setTarget(target)
Arguments:
  • target (Point3()) – the new camera target

Sets the camera target

Return type:void

setUp

Camera.setUp(up)
Arguments:
  • up (Point3()) – the new camera up vector

Sets the camera up vector

Return type:void

setWidth

Camera.setWidth(width)
Arguments:
  • width (number()) – the new camera width

Sets the camera width

Return type:void

toJson

Camera.toJson()

Creates an object ready for JSON serialization.

Returns:The prepared object.
Return type:object

transform

Camera.transform(matrix)
Arguments:
Return type:

Camera

static create

Camera.create(pos, tar, up, projection, width, height[, nearLimit])
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()) – camera view width.
  • height (number()) – camera view height.
  • nearLimit (number()) – optional the camera near limit.

Creates a new camera object with the given parameters.

Returns:a new camera object.
Return type:Camera

static fromJson

Camera.fromJson(objData)
Arguments:
  • objData (any()) – An object given by [[toJson]].

Creates a new [[Camera]] from an object given by [[toJson]].

Returns:The prepared object.
Return type:Camera