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

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


####
Vec2
####

.. js:class:: cee.Vec2

   An immutable 2d vector with x, y  values.
   
   Used e.g. for texture coordinates
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~cee.Vec2.constructor`
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~cee.Vec2.x`
   * :js:data:`~cee.Vec2.y`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~cee.Vec2.equals`
   * :js:meth:`~cee.Vec2.getLength`
   * :js:meth:`~cee.Vec2.getLengthSquared`
   * :js:meth:`~cee.Vec2.getNegated`
   * :js:meth:`~cee.Vec2.getNormalized`
   * :js:meth:`~static cee.Vec2.add`
   * :js:meth:`~static cee.Vec2.dot`
   * :js:meth:`~static cee.Vec2.from`
   * :js:meth:`~static cee.Vec2.fromArray`
   * :js:meth:`~static cee.Vec2.negate`
   * :js:meth:`~static cee.Vec2.scale`
   * :js:meth:`~static cee.Vec2.sub`
   
   



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

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


.. js:method:: cee.Vec2.constructor

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



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

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


.. js:data:: cee.Vec2.x

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



.. js:data:: cee.Vec2.y

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



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

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


.. js:method:: cee.Vec2.equals

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



.. js:method:: cee.Vec2.getLength

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



.. js:method:: cee.Vec2.getLengthSquared

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



.. js:method:: cee.Vec2.getNegated

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



.. js:method:: cee.Vec2.getNormalized

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



.. js:method:: static cee.Vec2.add

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



.. js:method:: static cee.Vec2.dot

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



.. js:method:: static cee.Vec2.from

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



.. js:method:: static cee.Vec2.fromArray

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



.. js:method:: static cee.Vec2.negate

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



.. js:method:: static cee.Vec2.scale

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



.. js:method:: static cee.Vec2.sub

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




