import { r as __name } from "./rolldown-runtime.mjs"; //#region src/geometry/types.d.ts interface XYPoint { x: number; y: number; } interface Dimensions { width: number; height: number; } type Point = readonly [x: number, y: number]; declare function isPoint(point: unknown): point is Point; /** * Converts between Point (tuple) and XYPoint (object) representations. * * @param point - The point to convert (either XYPoint or Point tuple) * @returns The converted point in the alternate format * * @example * ```ts * // Convert tuple to object * convertPoint([10, 20]) // returns { x: 10, y: 20 } * * // Convert object to tuple * convertPoint({ x: 10, y: 20 }) // returns [10, 20] * ``` */ declare function convertPoint(point: Point): XYPoint; declare function convertPoint(point: XYPoint): Point; //#endregion //#region src/geometry/bbox.d.ts interface BBox { x: number; y: number; width: number; height: number; } declare const BBox: { center({ x, y, width, height }: BBox): XYPoint; /** * Returns the four corner points of the box in clockwise order starting from top-left */ toPoints({ x, y, width, height }: BBox): [XYPoint, XYPoint, XYPoint, XYPoint]; fromPoints(points: Point[]): BBox; merge(...boxes: BBox[]): BBox; fromRectBox(rect: RectBox): BBox; toRectBox(box: BBox): RectBox; /** * Expands the box by the given amount in all directions, or separately for each direction * @example * ```ts * BBox.expand({ x: 0, y: 0, width: 10, height: 10 }, 5) * // => { x: -5, y: -5, width: 20, height: 20 } * * BBox.expand({ x: 0, y: 0, width: 10, height: 10 }, { left: 5, right: 5, top: 5, bottom: 5 }) * // => { x: -5, y: -5, width: 20, height: 20 } * ``` */ expand(box: BBox, plus: number | { left?: number; right?: number; top?: number; bottom?: number; }): BBox; shrink(box: BBox, minus: number): BBox; /** * Returns true if `a` includes `b` (i.e. `b` is inside `a`) */ includes(a: BBox, b: BBox): boolean; }; interface RectBox { x1: number; y1: number; x2: number; y2: number; } declare const RectBox: { center({ x1, y1, x2, y2 }: RectBox): XYPoint; fromPoints(points: Point[]): RectBox; merge(...boxes: RectBox[]): RectBox; toBBox(box: RectBox): BBox; /** * Returns true if `a` includes `b` (i.e. `b` is inside `a`) */ includes(a: RectBox, b: RectBox): boolean; }; //#endregion //#region src/geometry/vector.d.ts interface VectorValue { readonly x: number; readonly y: number; } declare class Vector implements VectorValue { readonly x: number; readonly y: number; constructor(x: number, y: number); static create(position: VectorValue): Vector; static create(x: number, y: number): Vector; /** * Adds two vectors. * @param a The first vector. * @param b The second vector. * @returns The sum of the two vectors. */ static add(a: VectorValue, b: VectorValue): VectorValue; /** * Subtracts two vectors. * @param a The first vector. * @param b The second vector. * @returns The difference of the two vectors. */ static subtract(a: VectorValue, b: VectorValue): VectorValue; /** * Multiplies a vector by a scalar. * @param a The vector. * @param b The scalar. * @returns The scaled vector. */ static multiply(a: VectorValue, b: number): VectorValue; /** * Divides a vector by a scalar. * @param a The vector. * @param b The scalar. * @returns The scaled vector. */ static divide(a: VectorValue, b: number): VectorValue; /** * Calculates the dot product of the vectors. * @param a The first vector. * @param b The second vector. * @returns The dot product. */ static dot(a: VectorValue, b: VectorValue): number; /** * Adds the given vector to this vector. * @param b The vector to add. * @returns A new vector that is the sum of this vector and the given vector. */ add(b: VectorValue): Vector; /** * Subtracts the given vector from this vector. * @param b The vector to subtract. * @returns A new vector that is the difference of this vector and the given vector. */ subtract(b: VectorValue): Vector; /** * Multiplies this vector by a scalar. * @param b The scalar to multiply by. * @returns A new vector that is the product of this vector and the given scalar. */ multiply(b: number): Vector; /** * Divides this vector by a scalar. * @param b The scalar to divide by. * @returns A new vector that is the quotient of this vector and the given scalar. */ divide(b: number): Vector; /** * Calculates the dot product of this vector and another vector. * @param b The other vector. * @returns The dot product. */ dot(b: VectorValue): number; /** * Calculates the cross product of this vector and another vector. * The cross product of two 2D vectors is a scalar value: a.x * b.y - a.y * b.x * @param b The other vector. * @returns The cross product as a scalar. */ cross(b: VectorValue): number; /** * Calculates the length (magnitude) of this vector. * @returns The length of the vector. */ length(): number; /** * Normalizes the vector (makes it unit length, i.e., has a length of 1). * @returns A new vector that is the normalized version of this vector. */ normalize(): Vector; /** * Rounds the components of the vector to the nearest integers. * @returns A new vector with rounded components. */ round(): Vector; /** * Truncates the components of the vector (removes the decimal part). * @returns A new vector with truncated components. */ trunc(): Vector; /** * Converts the vector to a plain object. * @returns An object with x and y properties. */ toObject(): VectorValue; } declare function vector(source: VectorValue | Vector): Vector; declare function vector(x: number, y: number): Vector; //#endregion export { RectBox as a, XYPoint as c, BBox as i, convertPoint as l, VectorValue as n, Dimensions as o, vector as r, Point as s, Vector as t, isPoint as u };