import { vec2 } from 'linearly'; /** * A 2D rect represented as a tuple of two diagonal points. It must be guaranteed that the first point is the minimum and the second one is the maximum in the x and y axes. * @category Types */ export type Rect = readonly [min: vec2, max: vec2]; /** * Functions for manipulating rects represented as {@link Rect}. * @category Modules */ export declare namespace Rect { /** * Creates a rect from the given DOMRect. * @param domRect The DOMRect to create a rect from * @returns The created rect * @category Generators */ function fromDOMRect(domRect: DOMRect): Rect; /** * Creates a rect that contains all the given points. * @param points The points to create a rect from * @returns The created rect * @category Generators */ function fromPoints(...points: vec2[]): Rect; /** * Creates a rect from the minimum point and the size. * @param min Top-left point of the rect, in Y-down coordinates such as SVG * @param size The size of the rect. * @returns The created rect * @category Generators */ function bySize(min: vec2, size: vec2): Rect; /** * Creates a rect from the center and the size. * @param center The center of the rect * @param size The size of the rect * @returns The created rect * @category Generators */ function fromCenter(center: vec2, size: vec2): Rect; /** * Calculates the size of the given rect. * @param bbox The rect to calculate the size of * @returns The size of the rect * @category Properties */ function size(bbox: Rect): vec2; /** * Calculates the center of the given rect. * @param bbox The rect to calculate the center of * @returns The center of the rect * @category Properties */ function center(bbox: Rect): vec2; /** * Returns the left coordinate of the given rect in Y-down coordinates such as SVG. * @param bbox The rect to get the left of * @returns The left coordinate of the rect * @category Properties */ function left(bbox: Rect): number; /** * Returns the top coordinate of the given rect in Y-down coordinates such as SVG. * @param bbox The rect to get the top of * @returns The top coordinate of the rect * @category Properties */ function top(bbox: Rect): number; /** * Returns the right coordinate of the given rect in Y-down coordinates such as SVG. * @param bbox The rect to get the right of * @returns The right coordinate of the rect * @category Properties */ function right(bbox: Rect): number; /** * Returns the bottom coordinate of the given rect in Y-down coordinates such as SVG. * @param bbox The rect to get the bottom of * @returns The bottom coordinate of the rect * @category Properties */ function bottom(bbox: Rect): number; /** * Scales the given rect by the given ratio. * @param bbox The rect to scale * @param scale The ratio to scale the rect by * @returns The scaled rect */ function scale(bbox: Rect, scale: vec2 | number): Rect; /** * Translates the given rect by the given offset. * @param bbox The rect to translate * @param offset The offset to translate the rect by * @returns The translated rect */ function translate(bbox: Rect, offset: vec2): Rect; /** * Checks if the given rect contains the other rect. * @param source The source rect * @param target The target rect to check if it's contained in the source rect * @returns True if the source rect contains the target rect, false otherwise */ function contains(source: Rect, target: Rect): boolean; /** * Checks if the given rect contains the given point. * @param bbox The source rect * @param point The point to check if it's contained in the source rect * @returns True if the rect contains the point, false otherwise */ function containsPoint(bbox: Rect, point: vec2): boolean; /** * Checks if the given rects intersect. * @param a The first rect * @param b The second rect * @returns True if the rects intersect, false otherwise */ function intersects(a: Rect, b: Rect): boolean; /** * Unites the given rects into a single rect. * @param rects The rects to unite * @returns The united rect */ function unite(...rects: Rect[]): Rect; /** * Calculates the intersection of the given rects. * @param rects The rects to intersect * @returns The intersected rect */ function intersect(...rects: Rect[]): Rect; } //# sourceMappingURL=Rect.d.ts.map