import { Vector2d } from "../math/vector2d.ts"; import { Polygon } from "./polygon.ts"; /** * A rectangle object. * @category Geometry */ export declare class Rect extends Polygon { /** * The shape type (used internally). */ type: string; /** * Creates a new rectangle. * @param x - The x position of the rectangle. * @param y - The y position of the rectangle. * @param w - The width of the rectangle. * @param h - The height of the rectangle. */ constructor(x: number, y: number, w: number, h: number); /** * Set new dimensions for the rectangle. * @param width - The new width of the rectangle. * @param height - The new height of the rectangle. */ setSize(width: number, height: number): this; /** * The left coordinate of the Rectangle. */ get left(): number; /** * right coordinate of the Rectangle */ get right(): number; /** * top coordinate of the Rectangle */ get top(): number; /** * bottom coordinate of the Rectangle */ get bottom(): number; /** * width of the Rectangle */ get width(): number; set width(value: number); /** * height of the Rectangle */ get height(): number; set height(value: number); /** * absolute center of this rectangle on the horizontal axis */ get centerX(): number; set centerX(value: number); /** * absolute center of this rectangle on the vertical axis */ get centerY(): number; set centerY(value: number); /** * center the rectangle position around the given coordinates * @param x - the x coordinate around which to center this rectangle * @param y - the y coordinate around which to center this rectangle * @returns this rectangle */ centerOn(x: number, y: number): this; /** * resize the rectangle * @param w - new width of the rectangle * @param h - new height of the rectangle * @returns this rectangle */ resize(w: number, h: number): this; /** * scale the rectangle * @param x - a number representing the abscissa of the scaling vector. * @param [y=x] - a number representing the ordinate of the scaling vector. * @returns this rectangle */ scale(x: number, y?: number): this; /** * clone this rectangle * @returns new rectangle */ clone(): Rect; /** * copy the position and size of the given rectangle into this one * @param rect - Source rectangle * @returns new rectangle */ copy(rect: Rect): this; /** * merge this rectangle with another one * @param rect - other rectangle to union with * @returns the union(ed) rectangle */ union(rect: Rect): this; /** * check if this rectangle is intersecting with the specified one * @param rect Other rectangle. * @returns true if overlaps */ overlaps(rect: Rect): boolean; contains(x: number, y: number): boolean; contains(vector: Vector2d): boolean; /** * Returns true if the rectangle contains the given rectangle * @param rectangle - rectangle to test * @returns True if the rectangle contain the given rectangle, otherwise false * @example * if (rect.containsRectangle(myRect)) { * // do something * } */ containsRectangle(rectangle: Rect): boolean; /** * Check if this rectangle is identical to the specified one. * @param rect Other rectangle. * @returns true if equals */ equals(rect: Rect): boolean; /** * Determines whether all coordinates of this rectangle are finite numbers. * @returns false if all coordinates are positive or negative Infinity or NaN; otherwise, true. */ isFinite(): boolean; /** * Returns a polygon whose edges are the same as this box. * @returns a new Polygon that represents this rectangle. */ toPolygon(): Polygon; } export declare const rectPool: import("../system/pool.ts").Pool; //# sourceMappingURL=rectangle.d.ts.map