@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
38 lines • 1.84 kB
TypeScript
import type { Attribs } from "./api.js";
import { type ReadonlyVec, type Vec } from "@thi.ng/vectors/api";
import type { Circle } from "./api/circle.js";
import type { Polygon } from "./api/polygon.js";
import { Rect } from "./api/rect.js";
export declare function rect(pos: Vec, size: number | Vec, attribs?: Attribs): Rect;
export declare function rect(size: number | Vec, attribs?: Attribs): Rect;
export declare function rect(attribs?: Attribs): Rect;
export declare const rectFromMinMax: (min: Vec, max: Vec, attribs?: Attribs) => Rect;
export declare const rectFromMinMaxWithMargin: (min: Vec, max: Vec, margin: number, attribs?: Attribs) => Rect;
export declare const rectWithCentroid: (centroid: Vec, size: number | Vec, attribs?: Attribs) => Rect;
export declare const rectWithCentroidAndMargin: (centroid: Vec, size: number | Vec, margin: number, attribs?: Attribs) => Rect;
/**
* Returns the intersection rect of given inputs or `undefined` if they
* are non-overlapping.
*
* @param a -
* @param b -
*/
export declare const intersectionRect: (a: Rect, b: Rect) => Rect | undefined;
/**
* Returns square inscribed in given circle instance. The circle can also be
* given as centroid & radius.
*
* @param circle - target circle
* @param attribs -
*/
export declare function inscribedSquare(circle: Circle, attribs?: Attribs): Rect;
export declare function inscribedSquare(pos: ReadonlyVec, r: number, attribs?: Attribs): Rect;
/**
* Returns square inscribed in given (unrotated) hexagon. The hexagon
* can be given as {@link Polygon} or centroid and edge length.
*
* @param hex - target hexagon
*/
export declare function inscribedSquareHex(hex: Polygon, attribs?: Attribs): Rect;
export declare function inscribedSquareHex(pos: ReadonlyVec, len: number, attribs?: Attribs): Rect;
//# sourceMappingURL=rect.d.ts.map