UNPKG

malwoden

Version:

![alt text](./coverage/badge-lines.svg) ![alt text](./coverage/badge-statements.svg) ![alt text](./coverage/badge-functions.svg) ![alt text](./coverage/badge-branches.svg)

29 lines (28 loc) 1.04 kB
import { Vector2 } from "./vector"; /** Represents a basic rectangle. */ export declare class Rect { readonly v1: Vector2; readonly v2: Vector2; /** * Creates a rect from width + height. The width x height of a 1x1 block * would be 1, with v2 equal to v1. * @param v1 Vector2 - The starting vector * @param width number - The width. Min 1 * @param height number - The height - Min 1 * @returns Rect - A new rect with v2 computed from width/height */ static FromWidthHeight(v1: Vector2, width: number, height: number): Rect; /** * Creates a rectangle. Will internally set v1 to the min * coordinate corder, and v2 to the max corner. * * @param v1 - A vector representing one of the corners * @param v2 - A vector representing the other corner */ constructor(v1: Vector2, v2: Vector2); width(): number; height(): number; center(): Vector2; intersects(rect: Rect): boolean; contains(point: Vector2): boolean; }