Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Rect

Represents a basic rectangle.

Hierarchy

Index

Constructors

constructor

  • Creates a rectangle. Will internally set v1 to the min coordinate corder, and v2 to the max corner.

    Parameters

    • v1: Vector2

      A vector representing one of the corners

    • v2: Vector2

      A vector representing the other corner

    Returns Rect

Properties

Readonly v1

Readonly v2

Methods

center

contains

  • contains(point: Vector2): boolean

height

  • height(): number

intersects

  • intersects(rect: Rect): boolean

width

  • width(): number

Static FromWidthHeight

  • FromWidthHeight(v1: Vector2, width: number, height: number): Rect
  • Creates a rect from width + height. The width x height of a 1x1 block would be 1, with v2 equal to v1.

    Parameters

    • v1: Vector2

      Vector2 - The starting vector

    • width: number

      number - The width. Min 1

    • height: number

      number - The height - Min 1

    Returns Rect

    Rect - A new rect with v2 computed from width/height

Generated using TypeDoc