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

.isPlane : Boolean

Read-only flag to check if a given object is of type Plane.

.normal : Vector3

.constant : Float

Methods

.applyMatrix4(matrix : Matrix4, optionalNormalMatrix : Matrix3) → this

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:

const 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) → this

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 null 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() → this

Negates both the normal vector and the constant.

.normalize() → this

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) → this

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 this plane's normal and constant properties by copying the values from the given normal.

.setComponents(x : Float, y : Float, z : Float, w : Float) → this

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) → this

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) → this

normal — a unit length Vector3 defining the normal of the plane.
pointVector3.

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

.translate(offset : Vector3) → this

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.