Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "rectangle"

Index

Interfaces

Constructor Functions

Other Functions

Points Functions

Transform Functions

Constructor Functions

from

  • from(x: number, y: number, width: number, height: number): Rectangle
  • Creates a rectangle from x and y coordinates and a width and height.

    Parameters

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

    Returns Rectangle

fromBounds

  • fromBounds(x1: number, y1: number, x2: number, y2: number): Rectangle
  • Creates a rectangle from its bounds.

    Parameters

    • x1: number

      The left coordinate

    • y1: number

      The top coordinate

    • x2: number

      The right coordinate

    • y2: number

      The bottom coordinate

    Returns Rectangle

fromPoints

  • Creates a rectangle from two points.

    If necessary the coordinates will be flipped to ensure that the resulting rectangle does not have negative dimensions.

    Parameters

    Returns Rectangle

Other Functions

area

  • Calculates the area of rectangle.

    Parameters

    Returns number

clone

  • Creates a copy of rectangle that can be modified separately.

    Parameters

    Returns Rectangle

contains

  • Determines whether rectangle contains point.

    Parameters

    Returns boolean

equals

  • Determines whether r1 and r2 are equal.

    Rectangles are considered equal if they have the same coordinates and dimensions.

    Parameters

    Returns boolean

intersects

  • Determines whether r1 and r2 intersect.

    Parameters

    Returns boolean

is

  • is(value: any): value is Rectangle
  • Determines whether value is a Rectangle.

    Parameters

    • value: any

    Returns value is Rectangle

Points Functions

bottomLeft

  • Gets the bottom left point of rectangle.

    Parameters

    Returns Point

bottomRight

  • Gets the bottom right point of rectangle.

    Parameters

    Returns Point

center

  • Gets the center point of rectangle.

    Parameters

    Returns Point

topLeft

  • Gets the top left point of rectangle.

    Parameters

    Returns Point

topRight

  • Gets the top right point of rectangle.

    Parameters

    Returns Point

Transform Functions

translate

  • Translate rectangle by a vector.

    This modifies rectangle. Use translated if you want to create a new rectangle.

    Parameters

    Returns void

translated

  • Creates a new rectangle by translating rectangle by vector.

    Use translate if you want to modify rectangle instead.

    Parameters

    Returns Rectangle

Generated using TypeDoc