Communicator.Box

 Box

Represents an axis-aligned bounding box. A box is represented by a minimum and maximum point which describe the extents of the box.

Constructors

constructor

  • Creates a new box.

    Parameters

    • Optional min: Point3

      The minimum extent of the box. Defaults to the origin.

    • Optional max: Point3

      The maximum extent of the box. Defaults to the origin.

    Returns Box

Properties

max

max: Point3

The point of maximum extent for the box.

min

min: Point3

The point of minimum extent for the box.

Methods

addBox

  • addBox(box: Box): void
  • Expands the extents of the box so that it will contain another box.

    Parameters

    • box: Box

      The box to add.

    Returns void

addPoint

  • addPoint(point: Point3): void
  • Expands the extents of the box so that it will contain a particular point.

    Parameters

    • point: Point3

      The point to add.

    Returns void

center

  • Gets the center point for the box.

    Returns Point3

    The center point of this box.

copy

  • Creates a copy of the box.

    Returns Box

    A copy of this box.

equals

  • equals(box: Box): boolean
  • Strictly compares this box with another box.

    Parameters

    • box: Box

      Box to compare with.

    Returns boolean

    True if the values of this box equals the other. False otherwise.

extents

  • Gets the extents of the box.

    Returns Point3

    A point with members set to extent values for each corresponding axis.

forJson    [deprecated]

  • forJson(): Object
  • deprecated

    Use toJson instead.

    Returns Object

getCorners

  • getCorners(): Point3[]
  • Gets all eight corner points for the box.

    Returns Point3[]

    The corner points of this box.

isDegenerate

  • isDegenerate(): boolean
  • Returns whether or not the box is degenerate.

    Returns boolean

    whether or not the box is degenerate.

toJson

  • toJson(): Object
  • Creates an object ready for JSON serialization.

    Returns Object

    The prepared object.

Static construct    [deprecated]

  • construct(obj: any): Box
  • deprecated

    Use fromJson instead.

    Parameters

    • obj: any

    Returns Box

Static fromJson

  • fromJson(objData: any): Box
  • Creates a new Box from an object given by toJson.

    Parameters

    • objData: any

      An object given by toJson.

    Returns Box

    The prepared object.

Static invalid

  • invalid(): Box
  • Creates and returns an invalid bounding box.

    Returns Box

    an invalid bounding box.