import { Point } from "../geometries/point.ts"; import { Matrix2d } from "../math/matrix2d.ts"; import { Matrix3d } from "../math/matrix3d.ts"; import { Vector2d } from "../math/vector2d.ts"; import { XYPoint } from "../utils/types.ts"; /** * a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB). * @category Geometry */ export declare class Bounds { _center: Vector2d; type: string; min: XYPoint; max: XYPoint; /** * Constructs a Bounds object with optional vertices. * @param [vertices] - An array of Vector2d or Point to initialize the bounds. */ constructor(vertices?: Vector2d[] | Point[] | XYPoint[]); /** * Resets the bounds to its initial state. */ clear(): void; /** * Sets the bounds to the given minimum and maximum values. * @param minX - The minimum x value. * @param minY - The minimum y value. * @param maxX - The maximum x value. * @param maxY - The maximum y value. */ setMinMax(minX: number, minY: number, maxX: number, maxY: number): void; /** * Gets the x position of the bounds. * @returns The x position. */ get x(): number; /** * Sets the x position of the bounds. * @param value - The new x position. */ set x(value: number); /** * Gets the y position of the bounds. * @returns The y position. */ get y(): number; /** * Sets the y position of the bounds. * @param value - The new y position. */ set y(value: number); /** * Gets the width of the bounds. * @returns The width. */ get width(): number; /** * Sets the width of the bounds. * @param value - The new width. */ set width(value: number); /** * Gets the height of the bounds. * @returns The height. */ get height(): number; /** * Sets the height of the bounds. * @param value - The new height. */ set height(value: number); /** * Gets the left coordinate of the bounds. * @returns The left coordinate. */ get left(): number; /** * Gets the right coordinate of the bounds. * @returns The right coordinate. */ get right(): number; /** * Gets the top coordinate of the bounds. * @returns The top coordinate. */ get top(): number; /** * Gets the bottom coordinate of the bounds. * @returns The bottom coordinate. */ get bottom(): number; /** * Gets the center position of the bounds on the x axis. * @returns The center x coordinate. */ get centerX(): number; /** * Gets the center position of the bounds on the y axis. * @returns The center y coordinate. */ get centerY(): number; /** * Gets the center position of the bounds. * @returns The center position as a Vector2d. */ get center(): Vector2d; /** * Centers the bounds position around the given coordinates. * @param x - The x coordinate to center around. * @param y - The y coordinate to center around. * @returns The current Bounds instance for method chaining. */ centerOn(x: number, y: number): this; /** * Updates the bounds using the given vertices. * @param vertices - An array of Vector2d or Point to update the bounds. */ update(vertices: Vector2d[] | Point[] | XYPoint[]): void; /** * Adds the given vertices to the bounds definition. * @param vertices - An array of Vector2d or Point to add to the bounds. * @param [clear] - Whether to reset the bounds before adding the new vertices. Defaults to false. */ add(vertices: Vector2d[] | Point[] | XYPoint[], clear?: boolean): void; /** * Adds the given bounds to the bounds definition. * @param bounds - The bounds to add. * @param [clear] - Whether to reset the bounds before adding the new bounds. */ addBounds(bounds: Bounds, clear?: boolean): void; /** * Adds the given point to the bounds definition. * @param point - The point to add to the bounds. * @param [m] - An optional transform to apply to the given point. */ addPoint(point: Vector2d | Point, m?: Matrix2d | Matrix3d): void; /** * Adds the given quad coordinates to this bounds definition, multiplied by the given matrix. * @param x0 - The left x coordinate of the quad. * @param y0 - The top y coordinate of the quad. * @param x1 - The right x coordinate of the quad. * @param y1 - The bottom y coordinate of the quad. * @param [m] - An optional transform to apply to the given coordinates. */ addFrame(x0: number, y0: number, x1: number, y1: number, m?: Matrix2d | Matrix3d): void; /** * Returns true if the bounds contain the given point or vector. * @param xOrVectorOrBounds - The x coordinate, vector, or bounds to check. * @param [y] - The y coordinate if the first parameter is a number. * @returns True if the bounds contain the point or vector, otherwise false. */ contains(x: number, y: number): boolean; contains(vector: Vector2d | Bounds): boolean; /** * Returns true if the two bounds intersect. * @param bounds - The bounds to check for intersection. * @returns True if the bounds overlap, otherwise false. */ overlaps(bounds: Bounds): boolean; /** * Determines whether all coordinates of this bounds are finite numbers. * @returns False if any coordinates are positive or negative Infinity or NaN; otherwise, true. */ isFinite(): boolean; /** * Translates the bounds by the given point or vector. * @param xOrVector - The x coordinate or vector to translate by. * @param [y] - The y coordinate if the first parameter is a number. */ translate(x: number, y: number): void; translate(vector: Vector2d): void; /** * Shifts the bounds to the given x, y position or vector. * @param xOrVector - The x coordinate or vector to shift to. * @param [y] - The y coordinate if the first parameter is a number. */ shift(x: number, y: number): void; shift(vector: Vector2d): void; /** * Creates a clone of this bounds. * @returns A new Bounds object that is a copy of this bounds. */ clone(): Bounds; /** * Returns a polygon whose edges are the same as this bounds. * @returns A new Polygon that represents this bounds. */ toPolygon(): import("../index.ts").Polygon; } /** * A pool for creating and reusing Bounds objects. */ export declare const boundsPool: import("../system/pool.ts").Pool; //# sourceMappingURL=bounds.d.ts.map