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
function Plane( normal: Vector3, constant: Float ): void;
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
isPlane: Boolean;
Read-only flag to check if a given object is of type Plane.
normal
normal: Vector3;
constant
constant: Float;
Methods
applyMatrix4
function applyMatrix4( matrix: Matrix4, optionalNormalMatrix: Matrix3 ): this;
matrix - the [Page:Matrix4] to apply.
optionalNormalMatrix - (optional) pre-computed normal
[Page: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 THREE.Matrix3().getNormalMatrix( matrix );
clone
function clone( ): Plane;
Returns a new plane with the same .normal and .constant as this one.
coplanarPoint
function 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
function copy( plane: Plane ): this;
Copies the values of the passed plane's .normal and .constant properties to this plane.
distanceToPoint
function distanceToPoint( point: Vector3 ): Float;
Returns the signed distance from the point to the plane.
distanceToSphere
function distanceToSphere( sphere: Sphere ): Float;
Returns the signed distance from the sphere to the plane.
equals
function equals( plane: Plane ): Boolean;
Checks to see if two planes are equal (their .normal and .constant properties match).
intersectLine
function 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
function intersectsBox( box: Box3 ): Boolean;
box - the Box3 to check for intersection.
Determines whether or not this plane intersects box.
intersectsLine
function intersectsLine( line: Line3 ): Boolean;
line - the Line3 to check for intersection.
Tests whether a line segment intersects with (passes through) the plane.
intersectsSphere
function intersectsSphere( sphere: Sphere ): Boolean;
sphere - the Sphere to check for intersection.
Determines whether or not this plane intersects sphere.
negate
function negate( ): this;
Negates both the normal vector and the constant.
normalize
function normalize( ): this;
Normalizes the .normal vector, and adjusts the .constant value accordingly.
projectPoint
function 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
function 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
function 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.
.loat - the value of the plane's .constant property.
Set the individual components that define the plane.
setFromCoplanarPoints
function 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
function setFromNormalAndCoplanarPoint( normal: Vector3, point: Vector3 ):
this;
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
function 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.