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

new Plane(normalopt, constantopt)

Constructs a new Plane.

Parameters:
NameTypeAttributesDefaultDescription
normalVector3<optional>
Vector3(1, 0, 0)

A unit length Vector3 defining the normal of the plane.

constantnumber<optional>
0

The signed distance from the origin to the plane.

Methods

applyMatrix4(matrix, optionalNormalMatrixopt) → {Plane}

Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.

Parameters:
NameTypeAttributesDescription
matrixMatrix4

the Matrix4 to apply.

optionalNormalMatrixMatrix3<optional>

(optional) pre-computed normal Matrix3 of the Matrix4 being applied.

Returns:
Type: 
Plane

clone() → {Plane}

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

Returns:
Type: 
Plane

coplanarPoint(targetopt) → {Vector3}

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

Parameters:
NameTypeAttributesDescription
targetVector3<optional>
Returns:
Type: 
Vector3

copy(plane) → {Plane}

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

Parameters:
NameTypeDescription
planePlane
Returns:
Type: 
Plane

distanceToPoint(point) → {number}

Returns the signed distance from the point to the plane.

Parameters:
NameTypeDescription
pointVector3
Returns:
Type: 
number

mirrorPoint(point, targetopt) → {Vector3}

Reflects a point through the plane.

Parameters:
NameTypeAttributesDescription
pointVector3

the Vector3 to reflect through the plane.

targetVector3<optional>

the result will be copied into this Vector3.

Returns:
Type: 
Vector3

normalize() → {Plane}

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

Returns:
Type: 
Plane

projectPoint(point, targetopt) → {Vector3}

Projects a point onto the plane.

Parameters:
NameTypeAttributesDescription
pointVector3

the Vector3 to project onto the plane.

targetVector3<optional>

the result will be copied into this Vector3.

Returns:
Type: 
Vector3

set(normal, constant) → {Plane}

Sets this plane's normal and constant properties by copying the values from the given normal.

Parameters:
NameTypeDescription
normalVector3

a unit length Vector3 defining the normal of the plane.

constantnumber

the signed distance from the origin to the plane. Default is 0.

Returns:
Type: 
Plane

setComponents(x, y, z, w) → {Plane}

Set the individual components that define the plane.

Parameters:
NameTypeDescription
xnumber

x value of the unit length normal vector.

ynumber

y value of the unit length normal vector.

znumber

z value of the unit length normal vector.

wnumber

the value of the plane's constant property.

Returns:
Type: 
Plane

setFromCoplanarPoints(a, b, c) → {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.

Parameters:
NameTypeDescription
aVector3

first point on the plane.

bVector3

second point on the plane.

cVector3

third point on the plane.

Returns:
Type: 
Plane

setFromNormalAndCoplanarPoint(normal, point) → {Plane}

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

Parameters:
NameTypeDescription
normalVector3

a unit length Vector3 defining the normal of the plane.

pointVector3

Vector3

Returns:
Type: 
Plane

(static) intersectPlanes(p1, p2, p3, target) → {Vector3}

Solve a system of equations to find the point where the three planes intersect.

Parameters:
NameTypeDescription
p1Plane

The first plane.

p2Plane

The second plane.

p3Plane

The third plane.

targetVector3

The result will be copied into this Vector3.

Returns:
Type: 
Vector3