Options
All
  • Public
  • Public/Protected
  • All
Menu

Representation of an rectangle.

Hierarchy

  • Rect

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Rect(x?: number, y?: number, w?: number, h?: number): Rect
  • Constructs a new Rect.

    Parameters

    • x: number = 0

      X component.

    • y: number = 0

      Y component.

    • w: number = 0

      Width.

    • h: number = 0

      Height.

    Returns Rect

Properties

h

h: number

Height.

w

w: number

Width.

x

x: number

X component.

y

y: number

Y component.

Accessors

bottom

  • get bottom(): number

halfSize

left

  • get left(): number

right

  • get right(): number

top

  • get top(): number

Methods

intersects

  • intersects(other: Rect): boolean
  • drawing
    +---------+
    | a +---|-----+
    | | i | |
    +-----|---+ b |
    +---------+
    // a - this rect
    // b - other rect
    // i - intersection, if it happens then this method returns true,
    // if not then obviously it's false

    Parameters

    • other: Rect

      Other rectangle to check.

    Returns boolean

    True when intersecting, false when not.

Generated using TypeDoc