Constructor
new Plane(normalopt, constantopt)
Constructs a new Plane.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
normal | Vector3 | <optional> | Vector3(1, 0, 0) | A unit length Vector3 defining the normal of the plane. |
constant | number | <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.
Name | Type | Attributes | Description |
---|---|---|---|
matrix | Matrix4 | the Matrix4 to apply. | |
optionalNormalMatrix | Matrix3 | <optional> | (optional) pre-computed normal Matrix3 of the Matrix4 being applied. |
- Type:
- Plane
clone() → {Plane}
Returns a new plane with the same normal and constant as this one.
- 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.
Name | Type | Attributes | Description |
---|---|---|---|
target | Vector3 | <optional> |
- Type:
- Vector3
copy(plane) → {Plane}
Copies the values of the passed plane's normal and constant properties to this plane.
Name | Type | Description |
---|---|---|
plane | Plane |
- Type:
- Plane
distanceToPoint(point) → {number}
Returns the signed distance from the point to the plane.
Name | Type | Description |
---|---|---|
point | Vector3 |
- Type:
- number
mirrorPoint(point, targetopt) → {Vector3}
Reflects a point through the plane.
Name | Type | Attributes | Description |
---|---|---|---|
point | Vector3 | the Vector3 to reflect through the plane. | |
target | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
normalize() → {Plane}
Normalizes the normal vector, and adjusts the constant value accordingly.
- Type:
- Plane
projectPoint(point, targetopt) → {Vector3}
Projects a point onto the plane.
Name | Type | Attributes | Description |
---|---|---|---|
point | Vector3 | the Vector3 to project onto the plane. | |
target | Vector3 | <optional> | the result will be copied into this Vector3. |
- Type:
- Vector3
set(normal, constant) → {Plane}
Sets this plane's normal and constant properties by copying the values from the given normal.
Name | Type | Description |
---|---|---|
normal | Vector3 | a unit length Vector3 defining the normal of the plane. |
constant | number | the signed distance from the origin to the plane. Default is 0. |
- Type:
- Plane
setComponents(x, y, z, w) → {Plane}
Set the individual components that define the plane.
Name | Type | Description |
---|---|---|
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. |
- 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.
Name | Type | Description |
---|---|---|
a | Vector3 | first point on the plane. |
b | Vector3 | second point on the plane. |
c | Vector3 | third point on the plane. |
- Type:
- Plane
setFromNormalAndCoplanarPoint(normal, point) → {Plane}
Sets the plane's properties as defined by a normal and an arbitrary coplanar point.
Name | Type | Description |
---|---|---|
normal | Vector3 | a unit length Vector3 defining the normal of the plane. |
point | Vector3 | Vector3 |
- Type:
- Plane
(static) intersectPlanes(p1, p2, p3, target) → {Vector3}
Solve a system of equations to find the point where the three planes intersect.
Name | Type | Description |
---|---|---|
p1 | Plane | The first plane. |
p2 | Plane | The second plane. |
p3 | Plane | The third plane. |
target | Vector3 | The result will be copied into this Vector3. |
- Type:
- Vector3