Class Rect

Rectangle shape.

x and y are the rectangle's origin, width and height extend along the positive x/y axes.

Implements

Constructors

  • Parameters

    • x: number

      X origin.

    • y: number

      Y origin.

    • width: number

      Extent along positive X axis.

    • height: number

      Extent along positive Y axis.

    Returns Rect

Properties

height: number

Extent along positive Y axis.

width: number

Extent along positive X axis.

x: number

X origin.

y: number

Y origin.

Accessors

Methods

  • Ceil this rect (floors x and y, ceils width and height).

    Returns this

    Self

  • Floor this rect (ceils x and y, floors width and height).

    Returns this

    Self

  • Inversely multiply this rect by a matrix.

    Parameters

    Returns this

    Self

    Projected rect will be axis-aligned.

  • Parameters

    • x: number
    • y: number

    Returns this

  • Parameters

    • x: number
    • y: number
    • size: number

    Returns this

  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns this

  • Set center of this rect.

    Parameters

    • x: number

      Center x

    • Optionaly: number

      Center y

    Returns this

    Self

  • Set this rect's dimensions to a bounding box of points.

    Parameters

    • points: readonly Vec2Like[]

      Points to encompass

    Returns this

    Self

  • Parameters

    • __namedParameters: Vec2Like
    • width: number
    • height: number
    • centerOrigin: boolean = false

    Returns Rect