Plane

class cee.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]

Constructors

Accessors


Constructors

Plane.constructor(A, B, C, D)
Arguments:
  • A (number) – None

  • B (number) – None

  • C (number) – None

  • D (number) – None

Constructor

Return type:

Plane

Accessors

Plane.A()

The A coefficient of the plane equation

Return type:

number

Plane.B()

The B coefficient of the plane equation

Return type:

number

Plane.C()

The C coefficient of the plane equation

Return type:

number

Plane.D()

The D coefficient of the plane equation

Return type:

number

Methods

equals

Plane.equals(other)
Arguments:

Returns true if the planes are equal.

Return type:

boolean

getDistance

Plane.getDistance(point)
Arguments:

Returns the distance between the give point and this plane

Return type:

number

getDistanceSquared

Plane.getDistanceSquared(point)
Arguments:

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.

Return type:

number

getNormal

Plane.getNormal()

Returns the distance between the give point and this plane

Return type:

Vec3Like

getPointInPlane

Plane.getPointInPlane()

Returns a point guaranteed to be on this plane

Return type:

Vec3Like

projectPoint

Plane.projectPoint(point)
Arguments:

Project the given point onto the plane

Return type:

Vec3Like

projectVector

Plane.projectVector(vector)
Arguments:

Project the given vector onto the plane

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

Return type:

Vec3Like

static from

Plane.from(plane)
Arguments:

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

Return type:

Plane

static fromPointAndNormal

Plane.fromPointAndNormal(point, normal)
Arguments:

Returns a plane created from a point and a normal

Return type:

Plane

static fromPoints

Plane.fromPoints(p1, p2, p3)
Arguments:

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

Return type:

Plane