Plane

An infinite directed plane, representing the formula: a x + b y + c z + d = 0 Where [a, b, c] = N represents the plane's normal, and d is the distance from the plane to the origin, measured along the normal. The plane is stored in a Vector4 as [a, b, c, d].

Constructor

new L3D.Plane()

Methods

static testBoundingBox(plane, box) → Enum

Tests a bounding box against the plane.

Parameters
plane Plane
box BoundingBox
Returns
Enum

Clip.Outside if the box is completely behind the plane; Clip.Inside if the box is completely in front of the plane; Clip.Overlap if the box overlaps the plane.

static testPoint(plane, point) → number

Tests a point against the plane.

Parameters
plane *
point *
Returns
number

Clip.Outside if the point is behind the plane; Clip.Overlap if the point is on the plane; Clip.Inside if the point is in front of the plane.

static testSphere(plane, center, radius) → Enum

Tests a bounding sphere against the plane.

Parameters
plane Plane

The plane to test.

center Vector3

Center of the sphere.

radius number

Radius of the sphere.

Returns
Enum

Clip.Outside if the sphere is completely behind the plane; Clip.Inside if the sphere is completely in front of the plane; Clip.Overlap if the sphere overlaps the plane.

distanceToPoint(pt) → number

Calcualte the distance from the given point to the plane.

Parameters
pt Vector3

The point to check

Returns
number

The distance from pt to the plane.

dotNormal(v) → number

Calculate the dot product of the given vector with the plane's normal.

Parameters
v Vector3
Returns
number

rayIntersect(rayOrigin, rayDirection, out)Vector3

Intersect a ray with the plane.

Parameters
rayOrigin Vector3

The origin of the ray.

rayDirection Vector3

The direction of the ray.

out Vector3

Optional storage for the calculated intersection point.

Returns
Vector3

The point of the intersection, or null if the ray doesn"t intersect.