Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Rectangle

Hierarchy

  • Rectangle

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Rectangle(x?: number, y?: number, w?: number, h?: number): Rectangle
  • A simple rectangle class, containing some useful utility methods.

    constructor

    Parameters

    • Optional x: number

      The x-coordinate, defaulting to 0.

    • Optional y: number

      The y-coordinate, defaulting to 0.

    • Optional w: number

      The width of the rectangle, defaulting to 0.

    • Optional h: number

      The height of the rectangle, defaulting to 0.

    Returns Rectangle

Properties

h

h: number

w

w: number

x

x: number

y

y: number

Methods

intersects

  • Returns whether this rectangle intersects another.

    Parameters

    • rect2: Rectangle

      Another rectangle to compare against. This should not be null.

    Returns boolean

    Whether the two rectangles intersect.

set

  • set(x: number, y: number, w: number, h: number): void
  • Sets the bounds of this rectangle.

    Parameters

    • x: number

      The new x-coordinate.

    • y: number

      The new y-coordinate.

    • w: number

      The new width.

    • h: number

      The new height.

    Returns void

Generated using TypeDoc