.. role:: ts-api-decorator

######
Camera
######

.. container:: ts-api-section

   .. js: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).



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~Camera.constructor`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~Camera.copy`
   * :js:meth:`~Camera.dolly`
   * :js:meth:`~Camera.equals`
   * :js:meth:`~Camera.equalsWithTolerance`
   * :js:meth:`~Camera.getCameraPlaneIntersectionPoint`
   * :js:meth:`~Camera.getFullMatrix`
   * :js:meth:`~Camera.getHeight`
   * :js:meth:`~Camera.getNearLimit`
   * :js:meth:`~Camera.getPosition`
   * :js:meth:`~Camera.getProjection`
   * :js:meth:`~Camera.getProjectionMatrix`
   * :js:meth:`~Camera.getTarget`
   * :js:meth:`~Camera.getUp`
   * :js:meth:`~Camera.getViewMatrix`
   * :js:meth:`~Camera.getWidth`
   * :js:meth:`~Camera.setHeight`
   * :js:meth:`~Camera.setNearLimit`
   * :js:meth:`~Camera.setPosition`
   * :js:meth:`~Camera.setProjection`
   * :js:meth:`~Camera.setTarget`
   * :js:meth:`~Camera.setUp`
   * :js:meth:`~Camera.setWidth`
   * :js:meth:`~Camera.toJson`
   * :js:meth:`~Camera.transform`
   * :js:meth:`~Camera.create`
   * :js:meth:`~Camera.fromJson`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: Camera.constructor()



      :rtype: Camera



Methods
=======

.. rst-class:: ts-api-section

copy
----

.. js:method:: Camera.copy()



   Creates a copy of the camera.

   :returns: new object initialized with the current values of this camera


   :rtype: Camera

.. rst-class:: ts-api-section

dolly
-----

.. js:method:: Camera.dolly( delta)

   :param delta: None
   :type delta: Point3


   Move the camera along a delta


   :rtype: void

.. rst-class:: ts-api-section

equals
------

.. js:method:: Camera.equals( cam)

   :param cam: the camera to compare against
   :type cam: Camera


   Returns checks for equality with another camera


   :rtype: boolean

.. rst-class:: ts-api-section

equalsWithTolerance
-------------------

.. js:method:: Camera.equalsWithTolerance( cam, tolerance)

   :param cam: the camera to compare against
   :type cam: Camera
   :param tolerance: floating point tolerance
   :type tolerance: number


   Returns checks for equality with another camera with tolerance


   :rtype: boolean

.. rst-class:: ts-api-section

getCameraPlaneIntersectionPoint
-------------------------------

.. js:method:: Camera.getCameraPlaneIntersectionPoint( point, view)

   :param point: None
   :type point: Point2
   :param view: None
   :type view: View


   Finds the intersection point with the camera plane


   :rtype: null | Point3

.. rst-class:: ts-api-section

getFullMatrix
-------------

.. js:method:: Camera.getFullMatrix( viewer[, view])

   :param viewer: The [[WebViewer]] for which the matrix should be valid.
   :type viewer: WebViewer
   :param view: :ts-api-decorator:`optional` the [[View]] to use when calculating projection effects. Uses default view if undefined
   :type view: View


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


   :rtype: Matrix

.. rst-class:: ts-api-section

getHeight
---------

.. js:method:: Camera.getHeight()



   gets the camera height

   :returns: the camera width


   :rtype: number

.. rst-class:: ts-api-section

getNearLimit
------------

.. js:method:: Camera.getNearLimit()



   gets the camera near clipping limit

   :returns: the camera near clipping limit


   :rtype: number

.. rst-class:: ts-api-section

getPosition
-----------

.. js:method:: Camera.getPosition()



   gets the camera position

   :returns: the camera position


   :rtype: Point3

.. rst-class:: ts-api-section

getProjection
-------------

.. js:method:: Camera.getProjection()



   gets the camera projection

   :returns: the camera projection


   :rtype: Projection

.. rst-class:: ts-api-section

getProjectionMatrix
-------------------

.. js:method:: Camera.getProjectionMatrix( viewer[, view])

   :param viewer: The [[WebViewer]] for which the matrix should be valid.
   :type viewer: WebViewer
   :param view: :ts-api-decorator:`optional` the [[View]] to use when calculating projection effects. Uses default view if undefined
   :type view: View


   Returns the camera's projection matrix.


   :rtype: Matrix

.. rst-class:: ts-api-section

getTarget
---------

.. js:method:: Camera.getTarget()



   gets the camera target

   :returns: the camera target


   :rtype: Point3

.. rst-class:: ts-api-section

getUp
-----

.. js:method:: Camera.getUp()



   gets the camera up vector

   :returns: the camera up vector


   :rtype: Point3

.. rst-class:: ts-api-section

getViewMatrix
-------------

.. js:method:: Camera.getViewMatrix( viewer)

   :param viewer: The [[WebViewer]] for which the matrix should be valid.
   :type viewer: WebViewer


   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.


   :rtype: Matrix

.. rst-class:: ts-api-section

getWidth
--------

.. js:method:: Camera.getWidth()



   gets the camera width

   :returns: the camera width


   :rtype: number

.. rst-class:: ts-api-section

setHeight
---------

.. js:method:: Camera.setHeight( height)

   :param height: the new camera height
   :type height: number


   Sets the camera height


   :rtype: void

.. rst-class:: ts-api-section

setNearLimit
------------

.. js:method:: Camera.setNearLimit( nearLimit)

   :param nearLimit: the new camera near clipping limit
   :type nearLimit: number


   Sets the camera near clipping limit


   :rtype: void

.. rst-class:: ts-api-section

setPosition
-----------

.. js:method:: Camera.setPosition( position)

   :param position: the new camera position
   :type position: Point3


   Sets the camera position


   :rtype: void

.. rst-class:: ts-api-section

setProjection
-------------

.. js:method:: Camera.setProjection( projection)

   :param projection: the new camera Projection
   :type projection: Projection


   Sets the camera projection


   :rtype: void

.. rst-class:: ts-api-section

setTarget
---------

.. js:method:: Camera.setTarget( target)

   :param target: the new camera target
   :type target: Point3


   Sets the camera target


   :rtype: void

.. rst-class:: ts-api-section

setUp
-----

.. js:method:: Camera.setUp( up)

   :param up: the new camera up vector
   :type up: Point3


   Sets the camera up vector


   :rtype: void

.. rst-class:: ts-api-section

setWidth
--------

.. js:method:: Camera.setWidth( width)

   :param width: the new camera width
   :type width: number


   Sets the camera width


   :rtype: void

.. rst-class:: ts-api-section

toJson
------

.. js:method:: Camera.toJson()



   Creates an object ready for JSON serialization.

   :returns: The prepared object.


   :rtype: object

.. rst-class:: ts-api-section

transform
---------

.. js:method:: Camera.transform( matrix)

   :param matrix: None
   :type matrix: Matrix


   :rtype: Camera

.. rst-class:: ts-api-section

:ts-api-decorator:`static` create
---------------------------------

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

   :param pos: the camera position.
   :type pos: Point3
   :param tar: the camera target.
   :type tar: Point3
   :param up: the camera up vector.
   :type up: Point3
   :param projection: the camera projection mode.
   :type projection: Projection
   :param width: camera view width.
   :type width: number
   :param height: camera view height.
   :type height: number
   :param nearLimit: :ts-api-decorator:`optional` the camera near limit.
   :type nearLimit: number


   Creates a new camera object with the given parameters.

   :returns: a new camera object.


   :rtype: Camera

.. rst-class:: ts-api-section

:ts-api-decorator:`static` fromJson
-----------------------------------

.. js:method:: Camera.fromJson( objData)

   :param objData: An object given by [[toJson]].
   :type objData: any


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

   :returns: The prepared object.


   :rtype: Camera

