Plane(normal, constant)

Class representing a plane in 3D space. The plane is specified in Hessian normal form.

new Plane(normal, constant)

Constructs a new plane with the given values.

Parameters:
Name Type Default Description
normal Vector3

The normal vector of the plane.

constant Number 0

The distance of the plane from the origin.

Author:

Members

constant :Number

The distance of the plane from the origin.

normal :Vector3

The normal vector of the plane.

Methods

clone() → {Plane}

Creates a new plane and copies all values from this plane.

Returns:
Plane -

A new plane.

copy(plane) → {Plane}

Copies all values from the given plane to this plane.

Parameters:
Name Type Description
plane Plane

The plane to copy.

Returns:
Plane -

A reference to this plane.

distanceToPoint(point) → {Number}

Computes the signed distance from the given 3D vector to this plane. The sign of the distance indicates the half-space in which the points lies. Zero means the point lies on the plane.

Parameters:
Name Type Description
point Vector3

A point in 3D space.

Returns:
Number -

The signed distance.

equals(plane) → {Boolean}

Returns true if the given plane is deep equal with this plane.

Parameters:
Name Type Description
plane Plane

The plane to test.

Returns:
Boolean -

The result of the equality test.

fromCoplanarPoints(a, b, c) → {Plane}

Sets the values of the plane from three given coplanar points.

Parameters:
Name Type Description
a Vector3

A coplanar point.

b Vector3

A coplanar point.

c Vector3

A coplanar point.

Returns:
Plane -

A reference to this plane.

fromNormalAndCoplanarPoint(normal, point) → {Plane}

Sets the values of the plane from the given normal vector and a coplanar point.

Parameters:
Name Type Description
normal Vector3

A normalized vector.

point Vector3

A coplanar point.

Returns:
Plane -

A reference to this plane.

intersectPlane(plane, result) → {Vector3}

Performs a plane/plane intersection test and stores the intersection point to the given 3D vector. If no intersection is detected, null is returned.

Reference: Intersection of Two Planes in Real-Time Collision Detection by Christer Ericson (chapter 5.4.4)

Parameters:
Name Type Description
plane Plane

The plane to test.

result Vector3

The result vector.

Returns:
Vector3 -

The result vector.

intersectsPlane(plane) → {Boolean}

Returns true if the given plane intersects this plane.

Parameters:
Name Type Description
plane Plane

The plane to test.

Returns:
Boolean -

The result of the intersection test.

projectPoint(point, result) → {Vector3}

Projects the given point onto the plane. The result is written to the given vector.

Parameters:
Name Type Description
point Vector3

The point to project onto the plane.

result Vector3

The projected point.

Returns:
Vector3 -

The projected point.

set(normal, constant) → {Plane}

Sets the given values to this plane.

Parameters:
Name Type Description
normal Vector3

The normal vector of the plane.

constant Number

The distance of the plane from the origin.

Returns:
Plane -

A reference to this plane.