.. role:: clio-readonly
   :class: clio-flag clio-flag-readonly

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


####
Vec3
####

.. js:class:: cee.Vec3

   An immutable 3d vector with x, y and z values.
   
   Used for positions, normals and other 3d entities.
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~cee.Vec3.constructor`
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~cee.Vec3.x`
   * :js:data:`~cee.Vec3.y`
   * :js:data:`~cee.Vec3.z`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~cee.Vec3.equals`
   * :js:meth:`~cee.Vec3.getLength`
   * :js:meth:`~cee.Vec3.getLengthSquared`
   * :js:meth:`~cee.Vec3.getNegated`
   * :js:meth:`~cee.Vec3.getNormalized`
   * :js:meth:`~cee.Vec3.getPointDistance`
   * :js:meth:`~cee.Vec3.getPointDistanceSquared`
   * :js:meth:`~static cee.Vec3.add`
   * :js:meth:`~static cee.Vec3.cross`
   * :js:meth:`~static cee.Vec3.dot`
   * :js:meth:`~static cee.Vec3.from`
   * :js:meth:`~static cee.Vec3.fromArray`
   * :js:meth:`~static cee.Vec3.negate`
   * :js:meth:`~static cee.Vec3.scale`
   * :js:meth:`~static cee.Vec3.sub`
   * :js:meth:`~static cee.Vec3.transformPoint`
   * :js:meth:`~static cee.Vec3.transformVector`
   
   



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

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


.. js:method:: cee.Vec3.constructor

      .. rst-class:: sig-pretty-signature
      
         | Vec3(**x**\ : *number*\ , **y**\ : *number*\ , **z**\ : *number*\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Constructor
      
      **Parameters**
      
      
         **x**\ : *number*
      
         **y**\ : *number*
      
         **z**\ : *number*
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. rst-class:: kind-group kind-properties

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


.. js:data:: cee.Vec3.x

      .. rst-class:: clio-flags
      
         :clio-readonly:`readonly`
      
      .. rst-class:: sig-pretty-signature
      
         | x: *number*
      
      The x coordinate of the vector
      



.. js:data:: cee.Vec3.y

      .. rst-class:: clio-flags
      
         :clio-readonly:`readonly`
      
      .. rst-class:: sig-pretty-signature
      
         | y: *number*
      
      The y coordinate of the vector
      



.. js:data:: cee.Vec3.z

      .. rst-class:: clio-flags
      
         :clio-readonly:`readonly`
      
      .. rst-class:: sig-pretty-signature
      
         | z: *number*
      
      The z coordinate of the vector
      



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

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


.. js:method:: cee.Vec3.equals

      .. rst-class:: sig-pretty-signature
      
         | equals(**other**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): *boolean*
      
      Returns true if the vectors are equal
      
      **Parameters**
      
      
         **other**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : *boolean*
      



.. js:method:: cee.Vec3.getLength

      .. rst-class:: sig-pretty-signature
      
         | getLength(): *number*
      
      Returns the length of the vector (sqrt(x^2 + y^2 + z^2)).
      
      **Returns**\ : *number*
      



.. js:method:: cee.Vec3.getLengthSquared

      .. rst-class:: sig-pretty-signature
      
         | getLengthSquared(): *number*
      
      Returns the squared length of the vector
      
      **Returns**\ : *number*
      



.. js:method:: cee.Vec3.getNegated

      .. rst-class:: sig-pretty-signature
      
         | getNegated(): :js:class:`Vec3 <cee.Vec3>`
      
      Returns a negated version of the vector.
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: cee.Vec3.getNormalized

      .. rst-class:: sig-pretty-signature
      
         | getNormalized(): :js:class:`Vec3 <cee.Vec3>`
      
      Returns a normalized version of the vector.
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: cee.Vec3.getPointDistance

      .. rst-class:: sig-pretty-signature
      
         | getPointDistance(**otherPoint**\ : :js:class:`Vec3 <cee.Vec3>`\ ): *number*
      
      Returns the distance between this point and otherPoint
      
      **Parameters**
      
      
         **otherPoint**\ : :js:class:`Vec3 <cee.Vec3>`
      
      
      **Returns**\ : *number*
      



.. js:method:: cee.Vec3.getPointDistanceSquared

      .. rst-class:: sig-pretty-signature
      
         | getPointDistanceSquared(**otherPoint**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): *number*
      
      Returns the squared distance between this point and otherPoint
      
      **Parameters**
      
      
         **otherPoint**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : *number*
      



.. js:method:: static cee.Vec3.add

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | add(**a**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns the result of adding the two vectors
      
      **Parameters**
      
      
         **a**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.cross

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | cross(**a**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns the cross product of the 2 vectors
      
      **Parameters**
      
      
         **a**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.dot

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | dot(**a**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): *number*
      
      Returns the dot product of the 2 vectors
      
      **Parameters**
      
      
         **a**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : *number*
      



.. js:method:: static cee.Vec3.from

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | from(**vec**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Creates a new Vec3 instance from any object with x, y and z properties.
      
      **Parameters**
      
      
         **vec**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.fromArray

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | fromArray(**arr**\ : *ArrayLike*\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Creates a new Vec3 instance from the first 3 elements of the given array.
      
      **Parameters**
      
      
         **arr**\ : *ArrayLike*
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.negate

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | negate(**vec**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns the negation of the given vector
      
      **Parameters**
      
      
         **vec**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.scale

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | scale(**vec**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **factor**\ : *number*\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns the result of scaling the given vector by the given factor
      
      **Parameters**
      
      
         **vec**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **factor**\ : *number*
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.sub

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | sub(**a**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns the result of subtracting vector b from vector a
      
      **Parameters**
      
      
         **a**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **b**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.transformPoint

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | transformPoint(**p**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **matrix**\ : :js:class:`Mat4 <cee.Mat4>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns a new vector with the given vector transforms as a point.
      
      Transforms the vector as a point by multiplying it with the given matrix. This will both rotate and translate the vector p. Assumes the matrix m doesn't contain any perspective projection.
      
      **Parameters**
      
      
         **p**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **matrix**\ : :js:class:`Mat4 <cee.Mat4>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      



.. js:method:: static cee.Vec3.transformVector

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | transformVector(**p**\ : :js:class:`Vec3Like <cee.Vec3Like>`\ , **matrix**\ : :js:class:`Mat4 <cee.Mat4>`\ ): :js:class:`Vec3 <cee.Vec3>`
      
      Returns a new vector with the given vector transforms as a vector.
      
      Transforms the vector as a vector by multiplying it with the given matrix. This will only rotate the vector. The translation part of the matrix will be ignored. Assumes the matrix m doesn't contain any perspective projection.
      
      **Parameters**
      
      
         **p**\ : :js:class:`Vec3Like <cee.Vec3Like>`
      
         **matrix**\ : :js:class:`Mat4 <cee.Mat4>`
      
      
      **Returns**\ : :js:class:`Vec3 <cee.Vec3>`
      




