t3d. 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
normalt3d.Vector3<optional>
Vector3(1, 0, 0)A unit length Vector3 defining the normal of the plane.
constantNumber<optional>
0The signed distance from the origin to the plane.

Methods

applyMatrix4(matrix, optionalNormalMatrixopt)

Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.
Parameters:
NameTypeAttributesDescription
matrixt3d.Matrix4the Matrix4 to apply.
optionalNormalMatrixt3d.Matrix3<optional>
(optional) pre-computed normal Matrix3 of the Matrix4 being applied.

clone() → {t3d.Plane}

Returns a new plane with the same normal and constant as this one.
Returns:
Type: 
t3d.Plane

coplanarPoint(targetopt) → {t3d.Vector3}

Returns a Vector3 coplanar to the plane, by calculating the projection of the normal vector at the origin onto the plane.
Parameters:
NameTypeAttributesDescription
targett3d.Vector3<optional>
Returns:
Type: 
t3d.Vector3

copy(plane) → {t3d.Plane}

Copies the values of the passed plane's normal and constant properties to this plane.
Parameters:
NameTypeDescription
planet3d.Plane
Returns:
Type: 
t3d.Plane

distanceToPoint(point) → {Number}

Returns the signed distance from the point to the plane.
Parameters:
NameTypeDescription
pointt3d.Vector3
Returns:
Type: 
Number

mirrorPoint(point, targetopt) → {t3d.Vector3}

Reflects a point through the plane.
Parameters:
NameTypeAttributesDescription
pointt3d.Vector3the Vector3 to reflect through the plane.
targett3d.Vector3<optional>
the result will be copied into this Vector3.
Returns:
Type: 
t3d.Vector3

normalize() → {t3d.Plane}

Normalizes the normal vector, and adjusts the constant value accordingly.
Returns:
Type: 
t3d.Plane

projectPoint(point, targetopt) → {t3d.Vector3}

Projects a point onto the plane.
Parameters:
NameTypeAttributesDescription
pointt3d.Vector3the Vector3 to project onto the plane.
targett3d.Vector3<optional>
the result will be copied into this Vector3.
Returns:
Type: 
t3d.Vector3

set(normal, constant)

Sets this plane's normal and constant properties by copying the values from the given normal.
Parameters:
NameTypeDescription
normalt3d.Vector3a unit length Vector3 defining the normal of the plane.
constantNumberthe signed distance from the origin to the plane. Default is 0.

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

Set the individual components that define the plane.
Parameters:
NameTypeDescription
xNumberx value of the unit length normal vector.
yNumbery value of the unit length normal vector.
zNumberz value of the unit length normal vector.
wNumberthe value of the plane's constant property.
Returns:
Type: 
t3d.Plane

setFromCoplanarPoints(a, b, c) → {t3d.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
at3d.Vector3first point on the plane.
bt3d.Vector3second point on the plane.
ct3d.Vector3third point on the plane.
Returns:
Type: 
t3d.Plane

setFromNormalAndCoplanarPoint(normal, point)

Sets the plane's properties as defined by a normal and an arbitrary coplanar point.
Parameters:
NameTypeDescription
normalt3d.Vector3a unit length Vector3 defining the normal of the plane.
pointt3d.Vector3Vector3

(static) intersectPlanes(p1, p2, p3, target)

Solve a system of equations to find the point where the three planes intersect.
Parameters:
NameTypeDescription
p1t3d.PlaneThe first plane.
p2t3d.PlaneThe second plane.
p3t3d.PlaneThe third plane.
targett3d.Vector3The result will be copied into this Vector3.