Planes

This module provides the following plane classes:

    • Plane: Defines a mathematical plane determined by a contained point and a normal vector to the plane.
    • PolygonalPlane: Derived from Plane, this class adds support for calculations based on an externally supplied list of points which lie in the plane and define a closed polygonal boundary.

The Plane Class

Objects of this class represent mathematical planes determined by a contained point and a normal vector to the plane.

This class has the following construction methods:

Plane ()

Constructs a new plane with uninitialized values.

Returns the new plane.

Plane (plane)

plane -> s3d.vec.Plane

Constructs a new plane by copying the given plane.

Returns the new plane.

Plane (normal, origin)

normal -> s3d.vec.Normal3d

origin -> s3d.vec.Point3d

Constructs a new plane from the given plane normal and origin point.

Returns the new plane.

Every instance of this class has the following member methods:

Plane:Clone () -> s3d.vec.Plane

Returns a newly allocated copy of this object.

Plane:GetDistanceTo (point) -> number

point -> s3d.vec.Point3d

Returns the perpendicular distance from this plane to the given point.

Plane:GetIntersection (origin, direction) -> boolean, s3d.vec.Point3d, number

origin -> s3d.vec.Point3d

direction -> s3d.vec.Dir3d

Computes the intersection of a ray determined by the origin point and direction vector.

Returns three values, with the second two only valid for a true first value:

1) a boolean indicating whether the ray hit the plane or not.

2) a Point3d containing the intersection point for the hit.

3) a double containing the distance along the ray to the hit point.

Plane:GetNormal () -> s3d.vec.Normal3d

Returns a copy of the normal defining this plane.

Plane:GetOrigin () -> s3d.vec.Point3d

Returns a copy of the origin defining this plane.

Plane:GetProjection (point) -> s3d.vec.Point3d

point -> s3d.vec.Point3d

Returns a copy of the given point projected to line in the plane.

Plane:SetNormalAndOrigin (normal, origin) -> s3d.vec.PolygonalPlane

normal -> s3d.vec.Point3d

origin -> s3d.vec.Point3d

Modifies the plane to use the given plane normal and origin point.

The original plane is modified in place. Returns the newly modified plane.

The PolygonalPlane Class (derived from Plane)

This class is derived from the Plane class. Objects of this class provide plane functionality plus support for polygonal calculations.

This class has the following construction methods:

PolygonalPlane ()

Constructs a new plane with uninitialized values.

Returns the new plane.

PolygonalPlane (plane)

plane -> s3d.vec.PolygonalPlane

Constructs a new plane by copying the given plane.

Returns the new plane.

PolygonalPlane (normal, origin)

normal -> s3d.vec.Normal3d

origin -> s3d.vec.Point3d

Constructs a new plane from the given plane normal and origin point.

Returns the new plane.

Every instance of this class has all of the Plane methods plus the following member methods:

PolygonalPlane:Clone () -> s3d.vec.PolygonalPlane

Returns a newly allocated copy of this object.

PolygonalPlane:Const () -> s3d.vec.PolygonalPlane

Returns a constant reference to this object, useful in disabling further modification.

Although if the original object is modified after this call the constant reference will show the same changes since the underlying object is shared.

PolygonalPlane:IsPointInPolygon (point, polygonPoints) -> boolean

point -> s3d.vec.Point3d

polygonPoints -> s3d.vec.Point3dArray

Returns true if the given point is contained within the polygon defined by polygonPoints.

The point is probably the result of an earlier call to GetIntersection.