Constructor
new Plane(normalopt, constantopt)
Constructs a new Plane.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
normal | t3d. | <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)
Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
matrix | t3d. | the Matrix4 to apply. | |
optionalNormalMatrix | t3d. | <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:
Name | Type | Attributes | Description |
---|---|---|---|
target | t3d. | <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:
Name | Type | Description |
---|---|---|
plane | t3d. |
Returns:
- Type:
- t3d.
Plane
distanceToPoint(point) → {Number}
Returns the signed distance from the point to the plane.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. |
Returns:
- Type:
- Number
mirrorPoint(point, targetopt) → {t3d.Vector3}
Reflects a point through the plane.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
point | t3d. | the Vector3 to reflect through the plane. | |
target | t3d. | <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:
Name | Type | Attributes | Description |
---|---|---|---|
point | t3d. | the Vector3 to project onto the plane. | |
target | t3d. | <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:
Name | Type | Description |
---|---|---|
normal | t3d. | a unit length Vector3 defining the normal of the plane. |
constant | Number | the 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:
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. |
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:
Name | Type | Description |
---|---|---|
a | t3d. | first point on the plane. |
b | t3d. | second point on the plane. |
c | t3d. | third 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:
Name | Type | Description |
---|---|---|
normal | t3d. | a unit length Vector3 defining the normal of the plane. |
point | t3d. | Vector3 |
(static) intersectPlanes(p1, p2, p3, target)
Solve a system of equations to find the point where the three planes intersect.
Parameters:
Name | Type | Description |
---|---|---|
p1 | t3d. | The first plane. |
p2 | t3d. | The second plane. |
p3 | t3d. | The third plane. |
target | t3d. | The result will be copied into this Vector3. |