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


######
Point3
######

.. js:class:: Point3

   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~Point3.constructor`
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~Point3.x`
   * :js:data:`~Point3.y`
   * :js:data:`~Point3.z`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~Point3.add`
   * :js:meth:`~Point3.assign`
   * :js:meth:`~Point3.copy`
   * :js:meth:`~Point3.equals`
   * :js:meth:`~Point3.equalsWithTolerance`
   * :js:meth:`~Point3.fromArray`
   * :js:meth:`~Point3.isAxis`
   * :js:meth:`~Point3.length`
   * :js:meth:`~Point3.negate`
   * :js:meth:`~Point3.normalize`
   * :js:meth:`~Point3.scale`
   * :js:meth:`~Point3.set`
   * :js:meth:`~Point3.squaredLength`
   * :js:meth:`~Point3.subtract`
   * :js:meth:`~Point3.toArray`
   * :js:meth:`~Point3.toJson`
   * :js:meth:`~static Point3.add`
   * :js:meth:`~static Point3.createFromArray`
   * :js:meth:`~static Point3.cross`
   * :js:meth:`~static Point3.distance`
   * :js:meth:`~static Point3.dot`
   * :js:meth:`~static Point3.fromJson`
   * :js:meth:`~static Point3.magnitude`
   * :js:meth:`~static Point3.normalize`
   * :js:meth:`~static Point3.scale`
   * :js:meth:`~static Point3.squaredLength`
   * :js:meth:`~static Point3.subtract`
   * :js:meth:`~static Point3.zero`
   
   




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

.. js:method:: Point3.constructor

   .. rst-class:: sig-pretty-signature
   
      | Point3(**x**\ : *number*\ , **y**\ : *number*\ , **z**\ : *number*\ ): :js:class:`~Point3`
   
   Creates a new point object.
   
   **Parameters**
   
      **x**\ : *number*
   
         X value
   
   
      **y**\ : *number*
   
         Y value
   
   
      **z**\ : *number*
   
         Z value
   
   
   
   **Returns**\ : :js:class:`~Point3`
   





Properties
==========

.. js:data:: Point3.x

   .. rst-class:: sig-pretty-signature
   
      | x: *number*
   



.. js:data:: Point3.y

   .. rst-class:: sig-pretty-signature
   
      | y: *number*
   



.. js:data:: Point3.z

   .. rst-class:: sig-pretty-signature
   
      | z: *number*
   





Methods
=======

.. js:method:: Point3.add

   .. rst-class:: sig-pretty-signature
   
      | add(**pt**\ : :js:class:`~IPoint3`\ ): *this*
   
   Adds another point to this point.
   
   **Parameters**
   
      **pt**\ : :js:class:`~IPoint3`
   
   
   **Returns**\ : *this*
   
      This point object.
   
   



.. js:method:: Point3.assign

   .. rst-class:: sig-pretty-signature
   
      | assign(**point**\ : :js:class:`~IPoint3`\ ): *this*
   
   Sets this point equal to another point.
   
   **Parameters**
   
      **point**\ : :js:class:`~IPoint3`
   
         The point to assign.
   
   
   
   **Returns**\ : *this*
   
      This point object.
   
   



.. js:method:: Point3.copy

   .. rst-class:: sig-pretty-signature
   
      | copy(): :js:class:`~Point3`
   
   Creates a copy of this point.
   
   **Returns**\ : :js:class:`~Point3`
   
      Copy of this point object.
   
   



.. js:method:: Point3.equals

   .. rst-class:: sig-pretty-signature
   
      | equals(**other**\ : :js:class:`~IPoint3`\ ): *boolean*
   
   Strictly compares this point with another.
   
   **Parameters**
   
      **other**\ : :js:class:`~IPoint3`
   
         Point to compare with.
   
   
   
   **Returns**\ : *boolean*
   
      True if the values of this point equal those of the other.
   
   



.. js:method:: Point3.equalsWithTolerance

   .. rst-class:: sig-pretty-signature
   
      | equalsWithTolerance(**other**\ : :js:class:`~IPoint3`\ , **tolerance**\ : *number*\ ): *boolean*
   
   Compares this point with another using a tolerance.
   
   **Parameters**
   
      **other**\ : :js:class:`~IPoint3`
   
         Point to compare with.
   
   
      **tolerance**\ : *number*
   
         Tolerance to be used in the comparison.
   
   
   
   **Returns**\ : *boolean*
   
      True if the values of this point equal those of the other.
   
   



.. js:method:: Point3.fromArray

   .. rst-class:: sig-pretty-signature
   
      | fromArray(**arr**\ : *number*\ []): *this*
   
   Sets this point from an array.
   
   **Parameters**
   
      **arr**\ : *number*\ []
   
         Array to assign from.
   
   
   
   **Returns**\ : *this*
   
      This point object.
   
   



.. js:method:: Point3.isAxis

   .. rst-class:: sig-pretty-signature
   
      | isAxis(): *boolean*
   
   Returns a boolean value indicating if this vector lies on a major axis.
   
   **Returns**\ : *boolean*
   



.. js:method:: Point3.length

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



.. js:method:: Point3.negate

   .. rst-class:: sig-pretty-signature
   
      | negate(): *this*
   
   Negates the point.
   
   **Returns**\ : *this*
   
      This object.
   
   



.. js:method:: Point3.normalize

   .. rst-class:: sig-pretty-signature
   
      | normalize(): *this*
   
   Normalizes the vector.
   
   **Returns**\ : *this*
   
      This object.
   
   



.. js:method:: Point3.scale

   .. rst-class:: sig-pretty-signature
   
      | scale(**k**\ : *number*\ ): *this*
   
   Scale the point by constant value.
   
   **Parameters**
   
      **k**\ : *number*
   
         Constant value to scale by.
   
   
   
   **Returns**\ : *this*
   
      Point object.
   
   



.. js:method:: Point3.set

   .. rst-class:: sig-pretty-signature
   
      | set(**x**\ : *number*\ , **y**\ : *number*\ , **z**\ : *number*\ ): *this*
   
   Sets the values of this point.
   
   **Parameters**
   
      **x**\ : *number*
   
         X value to set.
   
   
      **y**\ : *number*
   
         Y value to set.
   
   
      **z**\ : *number*
   
         Z value to set.
   
   
   
   **Returns**\ : *this*
   
      This point object.
   
   



.. js:method:: Point3.squaredLength

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



.. js:method:: Point3.subtract

   .. rst-class:: sig-pretty-signature
   
      | subtract(**pt**\ : :js:class:`~IPoint3`\ ): *this*
   
   Subtracts another point from this point.
   
   **Parameters**
   
      **pt**\ : :js:class:`~IPoint3`
   
   
   **Returns**\ : *this*
   
      This point object.
   
   



.. js:method:: Point3.toArray

   .. rst-class:: sig-pretty-signature
   
      | toArray(**arr**\ : *number*\ []?): *number*\ []
   
   Sets an array from this point.
   
   **Parameters**
   
      **arr**\ : *number*\ [] = ...
   
         Array to assign.
   
   
   
   **Returns**\ : *number*\ []
   



.. js:method:: Point3.toJson

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



.. js:method:: static Point3.add

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | add(**p1**\ : :js:class:`~IPoint3`\ , **p2**\ : :js:class:`~IPoint3`\ ): :js:class:`~Point3`
   
   Adds two points.
   
   **Parameters**
   
      **p1**\ : :js:class:`~IPoint3`
   
         First point.
   
   
      **p2**\ : :js:class:`~IPoint3`
   
         Second point.
   
   
   
   **Returns**\ : :js:class:`~Point3`
   
      Sum of p1 and p2.
   
   



.. js:method:: static Point3.createFromArray

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | createFromArray(**arr**\ : *number*\ []): :js:class:`~Point3`
   
   Creates a point from an array of numbers
   
   **Parameters**
   
      **arr**\ : *number*\ []
   
   
   **Returns**\ : :js:class:`~Point3`
   
      new point set from array elements
   
   



.. js:method:: static Point3.cross

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | cross(**p1**\ : :js:class:`~IPoint3`\ , **p2**\ : :js:class:`~IPoint3`\ ): :js:class:`~Point3`
   
   Calculate cross product.
   
   **Parameters**
   
      **p1**\ : :js:class:`~IPoint3`
   
         First point.
   
   
      **p2**\ : :js:class:`~IPoint3`
   
         Second point.
   
   
   
   **Returns**\ : :js:class:`~Point3`
   
      Cross product of p1 and p2.
   
   



.. js:method:: static Point3.distance

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | distance(**p1**\ : :js:class:`~IPoint3`\ , **p2**\ : :js:class:`~IPoint3`\ ): *number*
   
   Calculate distance between two points
   
   **Parameters**
   
      **p1**\ : :js:class:`~IPoint3`
   
         First point
   
   
      **p2**\ : :js:class:`~IPoint3`
   
         Second point
   
   
   
   **Returns**\ : *number*
   
      Distance between p1 and p2
   
   



.. js:method:: static Point3.dot

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | dot(**p1**\ : :js:class:`~IPoint3`\ , **p2**\ : :js:class:`~IPoint3`\ ): *number*
   
   Calculate dot product.
   
   **Parameters**
   
      **p1**\ : :js:class:`~IPoint3`
   
         First point.
   
   
      **p2**\ : :js:class:`~IPoint3`
   
         Second point.
   
   
   
   **Returns**\ : *number*
   
      Dot product of p1 and p2.
   
   



.. js:method:: static Point3.fromJson

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



.. js:method:: static Point3.magnitude

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | magnitude(**p**\ : :js:class:`~IPoint3`\ ): *number*
   
   Returns the length of a vector.
   
   **Parameters**
   
      **p**\ : :js:class:`~IPoint3`
   
   
   **Returns**\ : *number*
   
      Vector length.
   
   



.. js:method:: static Point3.normalize

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | normalize(**v**\ : :js:class:`~IPoint3`\ ): :js:class:`~Point3`
   
   Normalize a vector.
   
   **Parameters**
   
      **v**\ : :js:class:`~IPoint3`
   
         First point.
   
   
   
   **Returns**\ : :js:class:`~Point3`
   
      A vector that is colinear to v with a length of 1.
   
   



.. js:method:: static Point3.scale

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | scale(**p**\ : :js:class:`~IPoint3`\ , **k**\ : *number*\ ): :js:class:`~Point3`
   
   Scale a point by a constant factor
   
   **Parameters**
   
      **p**\ : :js:class:`~IPoint3`
   
      **k**\ : *number*
   
         Constant value to scale byS
   
   
   
   **Returns**\ : :js:class:`~Point3`
   
      Copy of p scaled by a constant factor
   
   



.. js:method:: static Point3.squaredLength

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | squaredLength(**p**\ : :js:class:`~IPoint3`\ ): *number*
   
   Returns the squared length of a vector.
   
   **Parameters**
   
      **p**\ : :js:class:`~IPoint3`
   
   
   **Returns**\ : *number*
   
      Vector squared length.
   
   



.. js:method:: static Point3.subtract

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | subtract(**p1**\ : :js:class:`~IPoint3`\ , **p2**\ : :js:class:`~IPoint3`\ ): :js:class:`~Point3`
   
   Subtract two points.
   
   **Parameters**
   
      **p1**\ : :js:class:`~IPoint3`
   
         First point.
   
   
      **p2**\ : :js:class:`~IPoint3`
   
         Second point.
   
   
   
   **Returns**\ : :js:class:`~Point3`
   
      Difference of p1 and p2.
   
   



.. js:method:: static Point3.zero

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | zero(): :js:class:`~Point3`
   
   Creates a new Point initialized to (0,0,0).
   
   **Returns**\ : :js:class:`~Point3`
   
      New point with all elements set to 0.
   
   





