.. role:: ts-api-decorator

#####
Plane
#####

.. js:module:: cee
   :noindex:

.. container:: ts-api-section

   .. js:class:: Plane

      An immutable plane.

      The class describes a plane by the equation: Ax + By + Cz + D = 0
      The plane's normal is defined by the coefficients [A, B, C]



.. container:: api-index-section

   .. rubric:: Constructors

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

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



.. container:: api-index-section

   .. rubric:: Accessors

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

   * :js:attr:`~cee.Plane.A`
   * :js:attr:`~cee.Plane.B`
   * :js:attr:`~cee.Plane.C`
   * :js:attr:`~cee.Plane.D`



.. container:: api-index-section

   .. rubric:: Methods

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

   * :js:meth:`~cee.Plane.equals`
   * :js:meth:`~cee.Plane.getDistance`
   * :js:meth:`~cee.Plane.getDistanceSquared`
   * :js:meth:`~cee.Plane.getNormal`
   * :js:meth:`~cee.Plane.getPointInPlane`
   * :js:meth:`~cee.Plane.projectPoint`
   * :js:meth:`~cee.Plane.projectVector`
   * :js:meth:`~cee.Plane.from`
   * :js:meth:`~cee.Plane.fromPointAndNormal`
   * :js:meth:`~cee.Plane.fromPoints`





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

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

.. container:: ts-api-section

   .. js:function:: Plane.constructor( A, B, C, D)

      :param A: None
      :type A: number
      :param B: None
      :type B: number
      :param C: None
      :type C: number
      :param D: None
      :type D: number


      Constructor


      :rtype: Plane



Accessors
=========

.. container:: ts-api-section

   .. js:function:: Plane.A()



      The A coefficient of the plane equation


      :rtype: number



.. container:: ts-api-section

   .. js:function:: Plane.B()



      The B coefficient of the plane equation


      :rtype: number



.. container:: ts-api-section

   .. js:function:: Plane.C()



      The C coefficient of the plane equation


      :rtype: number



.. container:: ts-api-section

   .. js:function:: Plane.D()



      The D coefficient of the plane equation


      :rtype: number



Methods
=======

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

equals
------

.. js:method:: Plane.equals( other)

   :param other: None
   :type other: PlaneLike


   Returns true if the planes are equal.


   :rtype: boolean

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

getDistance
-----------

.. js:method:: Plane.getDistance( point)

   :param point: None
   :type point: Vec3Like


   Returns the distance between the give point and this plane


   :rtype: number

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

getDistanceSquared
------------------

.. js:method:: Plane.getDistanceSquared( point)

   :param point: None
   :type point: Vec3Like


   Returns the square of the distance from the point to the plane

   The square of the distance is relatively fast to compute (no 'sqrt') and is useful for determine
   which side the point is on. To obtain the actual distance, divide by sqrt(A^2 + B^2 + C^2)
   or use the distance() function directly.


   :rtype: number

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

getNormal
---------

.. js:method:: Plane.getNormal()



   Returns the distance between the give point and this plane


   :rtype: Vec3Like

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

getPointInPlane
---------------

.. js:method:: Plane.getPointInPlane()



   Returns a point guaranteed to be on this plane


   :rtype: Vec3Like

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

projectPoint
------------

.. js:method:: Plane.projectPoint( point)

   :param point: None
   :type point: Vec3Like


   Project the given point onto the plane


   :rtype: Vec3Like

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

projectVector
-------------

.. js:method:: Plane.projectVector( vector)

   :param vector: None
   :type vector: Vec3Like


   Project the given vector onto the plane

   Returns the projected vector or undefined if the vector is parallel with the plane's normal


   :rtype: Vec3Like

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

:ts-api-decorator:`static` from
-------------------------------

.. js:method:: Plane.from( plane)

   :param plane: None
   :type plane: PlaneLike


   Creates a plane instance from any object with A,B,C,D properties


   :rtype: Plane

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

:ts-api-decorator:`static` fromPointAndNormal
---------------------------------------------

.. js:method:: Plane.fromPointAndNormal( point, normal)

   :param point: None
   :type point: Vec3Like
   :param normal: None
   :type normal: Vec3Like


   Returns a plane created from a point and a normal


   :rtype: Plane

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

:ts-api-decorator:`static` fromPoints
-------------------------------------

.. js:method:: Plane.fromPoints( p1, p2, p3)

   :param p1: None
   :type p1: Vec3Like
   :param p2: None
   :type p2: Vec3Like
   :param p3: None
   :type p3: Vec3Like


   Returns a plane created from three points

   The three points cannot be on a line as they need to define a plane.
   So (p2 - p1)*(p3 - p1) != 0


   :rtype: Plane

