.. role:: clio-static
   :class: clio-flag clio-flag-static


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

.. 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/hoops/visualize-web/latest/prog_guide/viewing/scene_attributes/camera.html>`_\ .
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~Camera.constructor`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :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:`~static Camera.create`
   * :js:meth:`~static Camera.fromJson`
   
   




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

.. js:method:: Camera.constructor

   .. rst-class:: sig-pretty-signature
   
      | Camera(): :js:class:`~Camera`
   
   **Returns**\ : :js:class:`~Camera`
   





Methods
=======

.. js:method:: Camera.copy

   .. rst-class:: sig-pretty-signature
   
      | copy(): :js:class:`~Camera`
   
   Creates a copy of the camera.
   
   **Returns**\ : :js:class:`~Camera`
   
      new object initialized with the current values of this camera
   
   



.. js:method:: Camera.dolly

   .. rst-class:: sig-pretty-signature
   
      | dolly(**delta**\ : :js:class:`~Point3`\ ): *void*
   
   Move the camera along a delta
   
   **Parameters**
   
      **delta**\ : :js:class:`~Point3`
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.equals

   .. rst-class:: sig-pretty-signature
   
      | equals(**cam**\ : :js:class:`~Camera`\ ): *boolean*
   
   Returns checks for equality with another camera
   
   **Parameters**
   
      **cam**\ : :js:class:`~Camera`
   
         the camera to compare against
   
   
   
   **Returns**\ : *boolean*
   



.. js:method:: Camera.equalsWithTolerance

   .. rst-class:: sig-pretty-signature
   
      | equalsWithTolerance(**cam**\ : :js:class:`~Camera`\ , **tolerance**\ : *number*\ ): *boolean*
   
   Returns checks for equality with another camera with tolerance
   
   **Parameters**
   
      **cam**\ : :js:class:`~Camera`
   
         the camera to compare against
   
   
      **tolerance**\ : *number*
   
         floating point tolerance
   
   
   
   **Returns**\ : *boolean*
   



.. js:method:: Camera.getCameraPlaneIntersectionPoint

   .. rst-class:: sig-pretty-signature
   
      | getCameraPlaneIntersectionPoint(**point**\ : :js:class:`~Point2`\ , **view**\ : :js:class:`~IView`\ ): (*None* \| :js:class:`~Point3`\ )
   
   Finds the intersection point with the camera plane
   
   **Parameters**
   
      **point**\ : :js:class:`~Point2`
   
      **view**\ : :js:class:`~IView`
   
   
   **Returns**\ : (*None* \| :js:class:`~Point3`\ )
   



.. js:method:: Camera.getFullMatrix

   .. rst-class:: sig-pretty-signature
   
      | getFullMatrix(**viewer**\ : :js:class:`~IWebViewer`\ , **view**\ : :js:class:`~IView`\ ): :js:class:`~Matrix`
   
   Returns the camera's projection matrix multiplied by its view matrix.
   
   **Parameters**
   
      **viewer**\ : :js:class:`~IWebViewer`
   
         The [[WebViewer]] for which the matrix should be valid.
   
   
      **view**\ : :js:class:`~IView`
   
         the [[View]] to use when calculating projection effects. Uses default view if undefined
   
   
   
   **Returns**\ : :js:class:`~Matrix`
   



.. js:method:: Camera.getHeight

   .. rst-class:: sig-pretty-signature
   
      | getHeight(): *number*
   
   gets the camera height
   
   **Returns**\ : *number*
   
      the camera width
   
   



.. js:method:: Camera.getNearLimit

   .. rst-class:: sig-pretty-signature
   
      | getNearLimit(): *number*
   
   gets the camera near clipping limit
   
   **Returns**\ : *number*
   
      the camera near clipping limit
   
   



.. js:method:: Camera.getPosition

   .. rst-class:: sig-pretty-signature
   
      | getPosition(): :js:class:`~Point3`
   
   gets the camera position
   
   **Returns**\ : :js:class:`~Point3`
   
      the camera position
   
   



.. js:method:: Camera.getProjection

   .. rst-class:: sig-pretty-signature
   
      | getProjection(): :js:data:`~Projection`
   
   gets the camera projection
   
   **Returns**\ : :js:data:`~Projection`
   
      the camera projection
   
   



.. js:method:: Camera.getProjectionMatrix

   .. rst-class:: sig-pretty-signature
   
      | getProjectionMatrix(**viewer**\ : :js:class:`~IWebViewer`\ , **view**\ : :js:class:`~IView`\ ): :js:class:`~Matrix`
   
   Returns the camera's projection matrix.
   
   **Parameters**
   
      **viewer**\ : :js:class:`~IWebViewer`
   
         The [[WebViewer]] for which the matrix should be valid.
   
   
      **view**\ : :js:class:`~IView`
   
         the [[View]] to use when calculating projection effects. Uses default view if undefined
   
   
   
   **Returns**\ : :js:class:`~Matrix`
   



.. js:method:: Camera.getTarget

   .. rst-class:: sig-pretty-signature
   
      | getTarget(): :js:class:`~Point3`
   
   gets the camera target
   
   **Returns**\ : :js:class:`~Point3`
   
      the camera target
   
   



.. js:method:: Camera.getUp

   .. rst-class:: sig-pretty-signature
   
      | getUp(): :js:class:`~Point3`
   
   gets the camera up vector
   
   **Returns**\ : :js:class:`~Point3`
   
      the camera up vector
   
   



.. js:method:: Camera.getViewMatrix

   .. rst-class:: sig-pretty-signature
   
      | getViewMatrix(**viewer**\ : :js:class:`~IWebViewer`\ ): :js:class:`~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**\ : :js:class:`~IWebViewer`
   
         The [[WebViewer]] for which the matrix should be valid.
   
   
   
   **Returns**\ : :js:class:`~Matrix`
   



.. js:method:: Camera.getWidth

   .. rst-class:: sig-pretty-signature
   
      | getWidth(): *number*
   
   gets the camera width
   
   **Returns**\ : *number*
   
      the camera width
   
   



.. js:method:: Camera.setHeight

   .. rst-class:: sig-pretty-signature
   
      | setHeight(**height**\ : *number*\ ): *void*
   
   Sets the camera height
   
   **Parameters**
   
      **height**\ : *number*
   
         the new camera height
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.setNearLimit

   .. rst-class:: sig-pretty-signature
   
      | setNearLimit(**nearLimit**\ : *number*\ ): *void*
   
   Sets the camera near clipping limit
   
   **Parameters**
   
      **nearLimit**\ : *number*
   
         the new camera near clipping limit
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.setPosition

   .. rst-class:: sig-pretty-signature
   
      | setPosition(**position**\ : :js:class:`~Point3`\ ): *void*
   
   Sets the camera position
   
   **Parameters**
   
      **position**\ : :js:class:`~Point3`
   
         the new camera position
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.setProjection

   .. rst-class:: sig-pretty-signature
   
      | setProjection(**projection**\ : :js:data:`~Projection`\ ): *void*
   
   Sets the camera projection
   
   **Parameters**
   
      **projection**\ : :js:data:`~Projection`
   
         the new camera Projection
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.setTarget

   .. rst-class:: sig-pretty-signature
   
      | setTarget(**target**\ : :js:class:`~Point3`\ ): *void*
   
   Sets the camera target
   
   **Parameters**
   
      **target**\ : :js:class:`~Point3`
   
         the new camera target
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.setUp

   .. rst-class:: sig-pretty-signature
   
      | setUp(**up**\ : :js:class:`~Point3`\ ): *void*
   
   Sets the camera up vector
   
   **Parameters**
   
      **up**\ : :js:class:`~Point3`
   
         the new camera up vector
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.setWidth

   .. rst-class:: sig-pretty-signature
   
      | setWidth(**width**\ : *number*\ ): *void*
   
   Sets the camera width
   
   **Parameters**
   
      **width**\ : *number*
   
         the new camera width
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Camera.toJson

   .. rst-class:: sig-pretty-signature
   
      | toJson(): *object*
   
   Creates an object ready for JSON serialization.
   
   **Returns**\ : *object*
   
      The prepared object.
   
   



.. js:method:: Camera.transform

   .. rst-class:: sig-pretty-signature
   
      | transform(**matrix**\ : :js:class:`~Matrix`\ ): :js:class:`~Camera`
   
   **Parameters**
   
      **matrix**\ : :js:class:`~Matrix`
   
   
   **Returns**\ : :js:class:`~Camera`
   



.. js:method:: static Camera.create

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | create(**pos**\ : :js:class:`~Point3`\ , **tar**\ : :js:class:`~Point3`\ , **up**\ : :js:class:`~Point3`\ , **projection**\ : :js:data:`~Projection`\ , **width**\ : *number*\ , **height**\ : *number*\ , **nearLimit**\ : *number*\ ): :js:class:`~Camera`
   
   Creates a new camera object with the given parameters.
   
   **Parameters**
   
      **pos**\ : :js:class:`~Point3`
   
         the camera position.
   
   
      **tar**\ : :js:class:`~Point3`
   
         the camera target.
   
   
      **up**\ : :js:class:`~Point3`
   
         the camera up vector.
   
   
      **projection**\ : :js:data:`~Projection`
   
         the camera projection mode.
   
   
      **width**\ : *number*
   
         camera view width.
   
   
      **height**\ : *number*
   
         camera view height.
   
   
      **nearLimit**\ : *number*
   
         the camera near limit.
   
   
   
   **Returns**\ : :js:class:`~Camera`
   
      a new camera object.
   
   



.. js:method:: static Camera.fromJson

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | fromJson(**objData**\ : *any*\ ): :js:class:`~Camera`
   
   Creates a new [[Camera]] from an object given by [[toJson]].
   
   **Parameters**
   
      **objData**\ : *any*
   
         An object given by [[toJson]].
   
   
   
   **Returns**\ : :js:class:`~Camera`
   
      The prepared object.
   
   





