Camera

class Camera()

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

Constructors

Camera.constructor()
Camera(): Camera

Returns: Camera

Methods

Camera.copy()
copy(): Camera

Creates a copy of the camera.

Returns: Camera

new object initialized with the current values of this camera
Camera.dolly()
dolly(delta: Point3): void

Move the camera along a delta

Parameters

delta: Point3

Returns: void

Camera.equals()
equals(cam: Camera): boolean

Returns checks for equality with another camera

Parameters

cam: Camera

the camera to compare against

Returns: boolean

Camera.equalsWithTolerance()
equalsWithTolerance(cam: Camera, tolerance: number): boolean

Returns checks for equality with another camera with tolerance

Parameters

cam: Camera

the camera to compare against

tolerance: number

floating point tolerance

Returns: boolean

Camera.getCameraPlaneIntersectionPoint()
getCameraPlaneIntersectionPoint(point: Point2, view: IView): (None | Point3)

Finds the intersection point with the camera plane

Parameters

point: Point2

view: IView

Returns: (None | Point3)

Camera.getFullMatrix()
getFullMatrix(viewer: IWebViewer, view: IView): Matrix

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

Parameters

viewer: IWebViewer

The [[WebViewer]] for which the matrix should be valid.

view: IView

the [[View]] to use when calculating projection effects. Uses default view if undefined

Returns: Matrix

Camera.getHeight()
getHeight(): number

gets the camera height

Returns: number

the camera width
Camera.getNearLimit()
getNearLimit(): number

gets the camera near clipping limit

Returns: number

the camera near clipping limit
Camera.getPosition()
getPosition(): Point3

gets the camera position

Returns: Point3

the camera position
Camera.getProjection()
getProjection(): Projection

gets the camera projection

Returns: Projection

the camera projection
Camera.getProjectionMatrix()
getProjectionMatrix(viewer: IWebViewer, view: IView): Matrix

Returns the camera’s projection matrix.

Parameters

viewer: IWebViewer

The [[WebViewer]] for which the matrix should be valid.

view: IView

the [[View]] to use when calculating projection effects. Uses default view if undefined

Returns: Matrix

Camera.getTarget()
getTarget(): Point3

gets the camera target

Returns: Point3

the camera target
Camera.getUp()
getUp(): Point3

gets the camera up vector

Returns: Point3

the camera up vector
Camera.getViewMatrix()
getViewMatrix(viewer: IWebViewer): Matrix

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.

Parameters

viewer: IWebViewer

The [[WebViewer]] for which the matrix should be valid.

Returns: Matrix

Camera.getWidth()
getWidth(): number

gets the camera width

Returns: number

the camera width
Camera.setHeight()
setHeight(height: number): void

Sets the camera height

Parameters

height: number

the new camera height

Returns: void

Camera.setNearLimit()
setNearLimit(nearLimit: number): void

Sets the camera near clipping limit

Parameters

nearLimit: number

the new camera near clipping limit

Returns: void

Camera.setPosition()
setPosition(position: Point3): void

Sets the camera position

Parameters

position: Point3

the new camera position

Returns: void

Camera.setProjection()
setProjection(projection: Projection): void

Sets the camera projection

Parameters

projection: Projection

the new camera Projection

Returns: void

Camera.setTarget()
setTarget(target: Point3): void

Sets the camera target

Parameters

target: Point3

the new camera target

Returns: void

Camera.setUp()
setUp(up: Point3): void

Sets the camera up vector

Parameters

up: Point3

the new camera up vector

Returns: void

Camera.setWidth()
setWidth(width: number): void

Sets the camera width

Parameters

width: number

the new camera width

Returns: void

Camera.toJson()
toJson(): object

Creates an object ready for JSON serialization.

Returns: object

The prepared object.
Camera.transform()
transform(matrix: Matrix): Camera

Parameters

matrix: Matrix

Returns: Camera

static Camera.create()

static

create(pos: Point3, tar: Point3, up: Point3, projection: Projection, width: number, height: number, nearLimit: number): Camera

Creates a new camera object with the given parameters.

Parameters

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

the camera near limit.

Returns: Camera

a new camera object.
static Camera.fromJson()

static

fromJson(objData: any): Camera

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

Parameters

objData: any

An object given by [[toJson]].

Returns: Camera

The prepared object.