Skip to main content

Plane

Infinite plane stored as [nx, ny, nz, constant]. Equation: nx*x + ny*y + nz*z + constant = 0. Functions modify the first argument in-place unless noted.


Functions Reference

Creation

FunctionReturnsDescription
plane_create(normal = [1,0,0], constant = 0)ArrayCreates a new plane.
plane_set(p, normal, constant)-Sets normal and constant.
plane_set_from_normal_and_coplanar_point(p, normal, point)-Sets plane from normal and a coplanar point.

Operations

FunctionReturnsDescription
plane_normalize(p)-Normalizes the plane normal.
plane_equals(p, p2)booleanReturns true if normals and constants match.
plane_negate(p)-Negates normal and constant.
plane_translate(p, offset)-Translates plane by offset vector.
plane_coplanar_point(p, [out])ArrayReturns a coplanar point.
plane_project_point(p, point, [out])ArrayProjects point onto plane.
plane_distance_to_point(p, point)numberSigned distance from point to plane.
plane_distance_to_sphere(p, sphere)numberSigned distance from sphere to plane.
plane_intersects_sphere(p, sphere)booleanReturns true if plane intersects sphere.
plane_intersect_line(p, line, [out])Array | undefinedIntersection point with segment [sx,sy,sz,ex,ey,ez].
plane_intersects_line(p, line)booleanReturns true if segment intersects plane.
plane_intersects_box(p, box)booleanReturns true if plane intersects axis-aligned box.
plane_apply_matrix4(p, m4, [normalMatrix3])-Applies transform; optional 3x3 normal matrix.
plane_set_from_coplanar_points(p, a, b, c)-Sets plane from three coplanar points.
plane_set_from_normal_and_coplanar_point(p, normal, point)-Sets plane from normal and coplanar point.