Class Rect3

The Rect3 implements a rectangle in three dimensional space. It is represented by two axes that extend from the specified origin. Axes should be perpendicular to each other and they extend in both positive and negative directions from the origin by the amount specified by extents.

The class follows the 'copy-on-write' pattern, which means that every operation returns a copy of the rectangle with updates values. It also implies that the values of the rectangle cannot be directly modified.

The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

Constructors

  • Parameters

    Returns Rect3

Properties

__axisHorizontal: Vector3
__axisVertical: Vector3
__center: Vector3
__extentHorizontal: number
__extentVertical: number

Accessors

  • get _axisHorizontal(): Vector3
  • Returns Vector3

  • set _axisHorizontal(value): void
  • Parameters

    Returns void

  • get _axisVertical(): Vector3
  • Returns Vector3

  • set _axisVertical(value): void
  • Parameters

    Returns void

  • get _center(): Vector3
  • Returns Vector3

  • set _center(value): void
  • Parameters

    Returns void

  • get _extentHorizontal(): number
  • Returns number

  • set _extentHorizontal(value): void
  • Parameters

    • value: number

    Returns void

  • get _extentVertical(): number
  • Returns number

  • set _extentVertical(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Copies all properties defined by the prototype of Rect3 from other to this instance.

    Parameters

    Returns Rect3

  • Clones this instance and returns a new Rect3 with identical values.

    Returns Rect3

  • Determines if this Rect3 instance is equal to the other instance.

    Parameters

    Returns boolean

  • Determines if both Rect3 instances are equal.

    Parameters

    Returns boolean

  • Creates a new rectangle.

    Parameters

    • center: Immutable<Vector3>

      Origin of the rectangle.

    • axes: Vector3[]

      Two axes that define orientation of the rectangle. Axes extend from the origin. Axes should be normalized.

    • extents: number[]

      Two extents that define the size of the rectangle. Extends should be half the width/height as they are applied in both directions.

    Returns Rect3