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.
A two dimensional surface that extends infinitely in 3d space, represented in Hessian normal form by a unit length normal vector and a constant.
Constructors
Constructor
new Plane(
normal?,constant?):Plane
Parameters
normal?
constant?
number
Returns
Plane
Properties
normal
normal:
Vector3
(optional) a unit length vector3 defining the normal of the plane.
Default Value
(1, 0, 0).
constant
constant:
number
(optional) the signed distance from the origin to the plane.
Default Value
0.
Methods
set()
set(
normal,constant):Plane
Sets this plane’s normal and constant properties by copying the values from the given normal.
Parameters
normal
a unit length Vector3 defining the normal of the plane.
constant
number
the signed distance from the origin to the plane.
Returns
Plane
Default Value
0.
setComponents()
setComponents(
x,y,z,w):Plane
Set the individual components that define the plane.
Parameters
x
number
x value of the unit length normal vector.
y
number
y value of the unit length normal vector.
z
number
z value of the unit length normal vector.
w
number
the value of the plane’s constant property.
Returns
Plane
setFromNormalAndCoplanarPoint()
setFromNormalAndCoplanarPoint(
normal,point):Plane
Sets the plane’s properties as defined by a normal and an arbitrary coplanar point.
Parameters
normal
a unit length Vector3 defining the normal of the plane.
point
Returns
Plane
setFromCoplanarPoints()
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
a
first point on the plane.
b
second point on the plane.
c
third point on the plane.
Returns
Plane
clone()
clone():
Plane
Returns a new plane with the same normal and constant as this one.
Returns
Plane
copy()
copy(
plane):Plane
Copies the values of the passed plane’s normal and constant properties to this plane.
Parameters
plane
Plane
Returns
Plane
normalize()
normalize():
Plane
Normalizes the normal vector, and adjusts the constant value accordingly.
Returns
Plane
negate()
negate():
Plane
Negates both the normal vector and the constant.
Returns
Plane
distanceToPoint()
distanceToPoint(
point):number
Returns the signed distance from the point to the plane.
Parameters
point
Returns
number
distanceToSphere()
distanceToSphere(
sphere):number
Returns the signed distance from the sphere to the plane.
Parameters
sphere
Returns
number
projectPoint()
projectPoint(
point,target):Vector3
Projects a point onto the plane.
Parameters
point
the Vector3 to project onto the plane.
target
the result will be copied into this Vector3.
Returns
intersectLine()
intersectLine(
line,target):Nullable<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.
Parameters
line
Line3
the Line3| Line3 to check for intersection.
target
the result will be copied into this Vector3.
Returns
Nullable<Vector3>
intersectsLine()
intersectsLine(
line):boolean
Tests whether a line segment intersects with (passes through) the plane.
Parameters
line
Line3
the Line3| Line3 to check for intersection.
Returns
boolean
intersectsBox()
intersectsBox(
box):boolean
Determines whether or not this plane intersects box.
Parameters
box
the Box3 to check for intersection.
Returns
boolean
intersectsSphere()
intersectsSphere(
sphere):boolean
Determines whether or not this plane intersects sphere.
Parameters
sphere
the Sphere to check for intersection.
Returns
boolean
coplanarPoint()
coplanarPoint(
target):Vector3
By calculating the projection of the normal vector at the origin onto the plane.
Parameters
target
the result will be copied into this Vector3.
Returns
a Vector3 coplanar to the plane,
applyMatrix4()
applyMatrix4(
matrix,optionalNormalMatrix?):Plane
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 );
Parameters
matrix
the Matrix4 to apply.
optionalNormalMatrix?
(optional) pre-computed normal [Page:Matrix3] of the Matrix4 being applied.
Returns
Plane
translate()
translate(
offset):Plane
Translates the plane by the distance defined by the offset vector.
Parameters
offset
the amount to move the plane by.
Returns
Plane
Tips
that this only affects the plane constant and will not affect the normal vector.
equals()
equals(
plane):boolean
Checks to see if two planes are equal (their normal and .constant| constant properties match).
Parameters
plane
Plane
Returns
boolean