Plane

A two dimensional surface that extends infinitely in 3d space, represented in Hessian normal form by a unit length normal vector and a constant.

Constructor

Plane(normal : Vector3, constant : Float)

normal - (optional) a unit length Vector3 defining the normal of the plane. Default is (1, 0, 0).
constant - (optional) the signed distance from the origin to the plane. Default is 0.

Properties

.normal : Vector3

.constant : Float

Methods

.applyMatrix4 (matrix : Matrix4, optionalNormalMatrix : Matrix3) : Plane

matrix - the Matrix4 to apply.
optionalNormalMatrix - (optional) pre-computed normal Matrix3 of the Matrix4 being applied.

Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.
If supplying an optionalNormalMatrix, it can be created like so: var optionalNormalMatrix = new v3d.Matrix3().getNormalMatrix(matrix);

.clone () : Plane

Returns a new plane with the same normal and constant as this one.

.coplanarPoint (target : Vector3) : Vector3

target — the result will be copied into this Vector3.

Returns a Vector3 coplanar to the plane, by calculating the projection of the normal vector at the origin onto the plane.

.copy (plane : Plane) : Plane

Copies the values of the passed plane's normal and constant properties to this plane.

.distanceToPoint (point : Vector3) : Float

Returns the signed distance from the point to the plane.

.distanceToSphere (sphere : Sphere) : Float

Returns the signed distance from the sphere to the plane.

.equals (plane : Plane) : Boolean

Checks to see if two planes are equal (their normal and constant properties match).

.intersectLine (line : Line3, target : Vector3) : Vector3

line - the Line3 to check for intersection.
target — the result will be copied into this Vector3.

Returns the intersection point of the passed line and the plane. Returns undefined if the line does not intersect. Returns the line's starting point if the line is coplanar with the plane.

.intersectsBox (box : Box3) : Boolean

box - the Box3 to check for intersection.

Determines whether or not this plane intersects box.

.intersectsLine (line : Line3) : Boolean

line - the Line3 to check for intersection.

Tests whether a line segment intersects with (passes through) the plane.

.intersectsSphere (sphere : Sphere) : Boolean

sphere - the Sphere to check for intersection.

Determines whether or not this plane intersects sphere.

.negate () : Plane

Negates both the normal vector and the constant.

.normalize () : Plane

Normalizes the normal vector, and adjusts the constant value accordingly.

.projectPoint (point : Vector3, target : Vector3) : Vector3

point - the Vector3 to project onto the plane.
target — the result will be copied into this Vector3.

Projects a point onto the plane.

.set (normal : Vector3, constant : Float) : Plane

normal - a unit length Vector3 defining the normal of the plane.
constant - the signed distance from the origin to the plane. Default is 0.

Sets the plane's normal and constant properties.

.setComponents (x : Float, y : Float, z : Float, w : Float) : Plane

x - x value of the unit length normal vector.
y - y value of the unit length normal vector.
z - z value of the unit length normal vector.
w - the value of the plane's constant property.

Set the individual components that define the plane.

.setFromCoplanarPoints (a : Vector3, b : Vector3, c : Vector3) : Plane

a - first point on the plane.
b - second point on the plane.
c - third point on the plane.

Defines the plane based on the 3 provided points. The winding order is assumed to be counter-clockwise, and determines the direction of the normal.

.setFromNormalAndCoplanarPoint (normal : Vector3, point : Vector3) : Plane this : Vector3

normal - a unit length Vector3 defining the normal of the plane.
point - Vector3

Sets the plane's properties as defined by a normal and an arbitrary coplanar point.

.translate (offset : Vector3) : Plane

offset - the amount to move the plane by.

Translates the plane by the distance defined by the offset vector. Note that this only affects the plane constant and will not affect the normal vector.

Source

For more info on how to obtain the source code of this module see this page.