Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Rect

Represents an immutable rectangle in 2D space.

PS2 instructions: DO NOT change this class. If you need more operations, define functions outside Rect.

Hierarchy

  • Rect

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Rect(x1: number, y1: number, x2: number, y2: number): Rect
  • Make a rectangle with opposing corners (x1, y1) and (x2, y2). Requires x1 <= x2 and y1 <= y2.

    Parameters

    • x1: number

      x-coordinate of one corner

    • y1: number

      y-coordinate of one corner

    • x2: number

      x-coordinate of other corner

    • y2: number

      y-coordinate of other corner

    Returns Rect

Properties

Readonly x1

x1: number

Readonly x2

x2: number

Readonly y1

y1: number

Readonly y2

y2: number

Methods

toString

  • toString(): string
  • Returns string

Generated using TypeDoc