.. role:: ts-api-decorator

###
Ray
###

.. js:module:: cee
   :noindex:

.. container:: ts-api-section

   .. js:class:: Ray

      A 3d ray used, for example, for picking on the 3D model.



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~cee.Ray.constructor`



.. container:: api-index-section

   .. rubric:: Accessors

   .. rst-class:: api-index-list-item api-kind-accessor api-parent-kind-class

   * :js:attr:`~cee.Ray.direction`
   * :js:attr:`~cee.Ray.origin`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~cee.Ray.clone`
   * :js:meth:`~cee.Ray.planeIntersect`
   * :js:meth:`~cee.Ray.pointDistanceSquared`
   * :js:meth:`~cee.Ray.transform`





------------

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

.. container:: ts-api-section

   .. js:function:: Ray.constructor( origin, direction)

      :param origin: None
      :type origin: Vec3Like
      :param direction: None
      :type direction: Vec3Like


      Creates a Ray object


      :rtype: Ray



Accessors
=========

.. container:: ts-api-section

   .. js:function:: Ray.direction()



      The direction vector of the ray in world coordinates.


      :rtype: Vec3Like

   .. js:function:: Ray.direction( direction)

      :param direction: None
      :type direction: Vec3Like


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Ray.origin()



      The origin of the ray in world coordinates.


      :rtype: Vec3Like

   .. js:function:: Ray.origin( origin)

      :param origin: None
      :type origin: Vec3Like


      :rtype: void



Methods
=======

.. rst-class:: ts-api-section

clone
-----

.. js:method:: Ray.clone()



   Returns a clone of the ray.


   :rtype: Ray

.. rst-class:: ts-api-section

planeIntersect
--------------

.. js:method:: Ray.planeIntersect( plane)

   :param plane: None
   :type plane: Plane


   Returns the intersection point of this ray with the given plane, or null if no intersection.


   :rtype: Vec3Like

.. rst-class:: ts-api-section

pointDistanceSquared
--------------------

.. js:method:: Ray.pointDistanceSquared( point)

   :param point: None
   :type point: Vec3Like


   Returns the squared distance from the point to the ray


   :rtype: number

.. rst-class:: ts-api-section

transform
---------

.. js:method:: Ray.transform( matrix)

   :param matrix: None
   :type matrix: Mat4


   Transforms the ray with the given matrix. 

   The origin will be transformed as a point, and the direction as a vector.


   :rtype: void

