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


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

.. js:class:: wv.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:`~wv.Camera.constructor`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~static wv.Camera.create`
   * :js:meth:`~static wv.Camera.fromJson`
   * :js:meth:`~wv.Camera.copy`
   * :js:meth:`~wv.Camera.dolly`
   * :js:meth:`~wv.Camera.equals`
   * :js:meth:`~wv.Camera.equalsWithTolerance`
   * :js:meth:`~wv.Camera.getCameraPlaneIntersectionPoint`
   * :js:meth:`~wv.Camera.getFullMatrix`
   * :js:meth:`~wv.Camera.getHeight`
   * :js:meth:`~wv.Camera.getNearLimit`
   * :js:meth:`~wv.Camera.getPosition`
   * :js:meth:`~wv.Camera.getProjection`
   * :js:meth:`~wv.Camera.getProjectionMatrix`
   * :js:meth:`~wv.Camera.getTarget`
   * :js:meth:`~wv.Camera.getUp`
   * :js:meth:`~wv.Camera.getViewMatrix`
   * :js:meth:`~wv.Camera.getWidth`
   * :js:meth:`~wv.Camera.setHeight`
   * :js:meth:`~wv.Camera.setNearLimit`
   * :js:meth:`~wv.Camera.setPosition`
   * :js:meth:`~wv.Camera.setProjection`
   * :js:meth:`~wv.Camera.setTarget`
   * :js:meth:`~wv.Camera.setUp`
   * :js:meth:`~wv.Camera.setWidth`
   * :js:meth:`~wv.Camera.toJson`
   * :js:meth:`~wv.Camera.transform`
   
   



.. rst-class:: kind-group kind-constructors

.. rubric:: Constructors
   :class: kind-group-title


.. js:method:: wv.Camera.constructor

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



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: static wv.Camera.create

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | create(**pos**\ : :js:class:`Point3 <wv.Point3>`\ , **tar**\ : :js:class:`Point3 <wv.Point3>`\ , **up**\ : :js:class:`Point3 <wv.Point3>`\ , **projection**\ : :js:data:`Projection <wv.Projection>`\ , **width**\ : *number*\ , **height**\ : *number*\ , **nearLimit**\ : *number*\ ): :js:class:`Camera <wv.Camera>`
      
      Creates a new camera object with the given parameters.
      
      **Parameters**
      
      
         **pos**\ : :js:class:`Point3 <wv.Point3>`
      
      
            the camera position.
      
      
         **tar**\ : :js:class:`Point3 <wv.Point3>`
      
      
            the camera target.
      
      
         **up**\ : :js:class:`Point3 <wv.Point3>`
      
      
            the camera up vector.
      
      
         **projection**\ : :js:data:`Projection <wv.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 <wv.Camera>`
      
      
         a new camera object.
      
      



.. js:method:: static wv.Camera.fromJson

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



.. js:method:: wv.Camera.copy

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



.. js:method:: wv.Camera.dolly

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



.. js:method:: wv.Camera.equals

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



.. js:method:: wv.Camera.equalsWithTolerance

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



.. js:method:: wv.Camera.getCameraPlaneIntersectionPoint

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



.. js:method:: wv.Camera.getFullMatrix

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



.. js:method:: wv.Camera.getHeight

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



.. js:method:: wv.Camera.getNearLimit

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



.. js:method:: wv.Camera.getPosition

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



.. js:method:: wv.Camera.getProjection

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



.. js:method:: wv.Camera.getProjectionMatrix

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



.. js:method:: wv.Camera.getTarget

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



.. js:method:: wv.Camera.getUp

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



.. js:method:: wv.Camera.getViewMatrix

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



.. js:method:: wv.Camera.getWidth

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



.. js:method:: wv.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:: wv.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:: wv.Camera.setPosition

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



.. js:method:: wv.Camera.setProjection

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



.. js:method:: wv.Camera.setTarget

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



.. js:method:: wv.Camera.setUp

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



.. js:method:: wv.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:: wv.Camera.toJson

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



.. js:method:: wv.Camera.transform

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




