Copyright © 2021 by K4.org
  (v.0.48.124)

Plane is a pure geometry object. It is used for geometric computations within rules. It is based on the three.js Plane object.

Hierarchy

Implements

  • IKnown

Index

Accessors

distance

distance:

normal

normal:

The returned value is not normalized.

Methods

contains

  • contains(p: Point): boolean
  • Returns true if the given point is on this plane

    Parameters

    • p: Point

      The point to test for containment

    Returns boolean

describe

  • describe(): string
  • Note that the numbers returned are for display purposes only, and are not precise enough to guarantee exact re-creation.

    Returns string

    A string of the form plane[n<x, y, z>, d=n]

distanceToPoint

  • distanceToPoint(p: Point): number
  • Returns the signed distance from this plane to the given point, with positive values along the plane normal.

    Parameters

    • p: Point

      The point to measure to

    Returns number

drop

  • Returns the point which is the given point dropped onto the plane

    Parameters

    • p: Point

      The point to drop

    Returns Point

flipNormal

  • Returns a new plane that is flipped in the normal.

    Returns Plane

    A new plane that is coplanar, but opposite normal to this.

get3

  • get3(): Plane3
  • Returns the three.js implementation object. Note that this is called Plane3 here, but called Plane in three.js.

    Returns Plane3

getFlattener

  • Returns a Frame which can be used to transform 3D points to this plane. The origin is dropped onto the plane to define the Frame origin. AAA is used to define the orientation.

    Parameters

    • Optional origin: Point

      Optional. If not supplied, the world origin is used.

    Returns Frame

intersectLine

  • intersectLine(line: Line, infinite?: boolean): GeomResult
  • Intersects the line with this plane. Possible outcomes:

    1. Point of intersection (status: regular, point: intersection)
    2. Coplanar line (parallel and point in common) (status: degenerate, point: line.start)
    3. No intersection (parallel line or point outside segment) (status: empty) If infinite is false (the default), restricts the intersection to the line segment.

    Parameters

    • line: Line

      The line to intersect with

    • Default value infinite: boolean = false

      Set to true if line should be treated as infinite Note: It was discovered on 22-Aug-2019 that the three.js implementation of Plane.intersectLine only does the line segment, we thus use our own function here which has the benefit of detecting all degenerate conditions and reporting them back.

    Returns GeomResult

intersectMesh

  • intersectMesh(mesh: GeometryDuck, transform: Frame): GeomResult
  • Intersects a mesh with this and ideally returns a set of Polygons.

    Parameters

    • mesh: GeometryDuck

      A mesh.

    • transform: Frame

    Returns GeomResult

intersectPlane

  • intersectPlane(plane: Plane): GeomResult
  • Intersects this plane with another. Possible outcomes:

    1. Line of intersection (status: regular)
    2. Coplanar plane (parallel and point in common) (status: degenerate)
    3. No intersection (parallel planes) (status: empty) Note that planes with opposite normals but which define the same set of points (any point on one is on the other), must return degenerate.

    Parameters

    Returns GeomResult

same

  • same(plane: Plane): boolean
  • Returns true if plane as the same normal and constant as this one

    Parameters

    • plane: Plane

      The plane to compare to

    Returns boolean

Static fromPoints

  • Compute the plane from the first 3 non-collinear points in the input. If no points or 3 collinear points cannot be found, will return a "best guess" plane based on what is available. Nothing gives an XY plane.

    Only the first 3 non-collinear points are used. There is no attempt made to try to "fit" a plane to all the points.

    Parameters

    • pts: Point[]

      The list of points.

    • Optional normal: Vector

      Optional. If supplied, defines the plane normal to use.

    Returns Plane