A plane in Hessian Normal Form defined by ax + by + cz + d = 0
where [a, b, c]
is the plane's normal
, d
is the signed distance to the plane (from the origin along the normal), and [x, y, z]
is any point on the plane.
Create the plane x=0
import {Plane} from '@math.gl/culling';
const plane = new Plane([1, 0, 0], 0.0);
Create a tangent plane for a cartographic coordinate
import {Plane} from '@math.gl/culling';
import {Ellipsoid} from '@math.gl/geospatial';
const point = [-72.0, 40.0, 0];
const normal = Ellipsoid.WGS84.geodeticSurfaceNormal([-72.0, 40.0]);
const tangentPlane = new Plane().fromPointNormal(point, normal);
The plane's normal.
The shortest distance from the origin to the plane. The sign of distance
determines which side of the plane the origin is on. If distance
is positive, the origin is in the half-space in the direction of the normal; if negative, the origin is in the half-space opposite to the normal; if zero, the plane passes through the origin.
Vector3
normal The plane's normal (normalized).distance
determines which side of the plane the origin is on. If distance
is positive, the origin is in the half-space in the direction of the normal; if negative, the origin is in the half-space opposite to the normal; if zero, the plane passes through the origin.Throws
Creates a plane from a normal and a point on the plane.
Vector3
point The point on the plane.Vector3
normal The plane's normal (normalized).Throws
Creates a plane from the general equation
coefficients
The plane coefficients (normalized).Throws
Duplicates a Plane instance.
Returns
Compares the provided Planes by normal and distance and returns true
if they are equal, false
otherwise.
right
The second plane.Returns
true
if left and right are equal, false
otherwise.Computes the signed shortest distance of a point to a plane. The sign of the distance determines which side of the plane the point is on. If the distance is positive, the point is in the half-space in the direction of the normal; if negative, the point is in the half-space opposite to the normal; if zero, the plane passes through the point.
point
The point.Returns
Projects a point onto the plane.
point
The point to project onto the planeresult
The result point. If undefined, a new Array
will be created.Returns
Vector3
instance if one was not provided.Transforms the plane by the given transformation matrix.
Returns
This class was ported from Cesium under the Apache 2 License.