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

BBox is a pure geometry object. It is used for geometric computations within rules. It is based on the three.js Box3 object. A bounding box is a world-coordinate-aligned box, typically used to define the xyz bounds of some geometry. Most geometric instances have a bbox rule that returns their bounding box.

Hierarchy

Implements

  • IKnown

Index

Constructors

constructor

  • new BBox(_box: Box3): BBox
  • Parameters

    • _box: Box3

    Returns BBox

Accessors

isEmpty

isEmpty:

Returns true if the bounding box has zero volume.

xSpan

xSpan:

Returns the x span of this BBox.

ySpan

ySpan:

Returns the y span of this BBox.

zSpan

zSpan:

Returns the z span of this BBox.

Methods

center

  • Returns the midpoint of the bounding box.

    Returns Point

containsBox

  • containsBox(box: BBox): boolean
  • Returns true if box is entirely inside this. If both boxes are identical, returns true.

    Parameters

    • box: BBox

      BBox to test for containment

    Returns boolean

containsPoint

  • containsPoint(p: Point): boolean
  • Returns true if p is inside this. If p is on a face, edge, or vertex of this, returns true.

    Parameters

    • p: Point

      Point to test for containment

    Returns boolean

describe

  • describe(): string
  • Returns a string of the form 'bb<<x, y, z>, <x, y, z>>' where x, y, and z are in world coordinates. Note that these values are for display only, and are not guaranteed to reproduce the bounding box if read back in.

    Returns string

expandByPoint

  • Returns a new BBox which represents this box expanded, if necessary, to contain p.

    Parameters

    • p: Point

      Point to add to the bounded volume

    Returns BBox

expandByScalar

  • expandByScalar(s: number): BBox
  • Returns a new BBox which represents this grown (or shrunk, if s is < 0) this box by s. The expansion is based on the center of the box.

    Parameters

    • s: number

      The absolute amount to add to each direction

    Returns BBox

get3

  • get3(): Box3
  • Returns the underlying three.js object.

    Returns Box3

intersect

  • Returns a new BBox of intersection between this and box2. Note that this will still return a BBox that isEmpty if there is no intersection.

    Parameters

    • box2: BBox

      The bounding box to intersect with

    Returns BBox

intersectsBox

  • intersectsBox(box2: BBox): boolean
  • Returns true if box2 intersects this.

    Parameters

    • box2: BBox

      The box to check against

    Returns boolean

intersectsPlane

  • intersectsPlane(plane: Plane): boolean
  • Return true if plane intersects this.

    Parameters

    • plane: Plane

      The plane to check against

    Returns boolean

max

  • Returns the point at maximum x y and z in the world.

    Returns Point

min

  • Returns the point at minimum x y and z in the world.

    Returns Point

union

  • Returns the box of union between this and box2.

    Parameters

    • box2: BBox

      The bounding box to union with

    Returns BBox