UNPKG

@thi.ng/geom

Version:

Functional, polymorphic API for 2D geometry types & SVG generation

36 lines 1.4 kB
import type { Maybe } from "@thi.ng/api"; import type { IShape, IShape2, IShape3 } from "./api.js"; import type { AABB } from "./api/aabb.js"; import type { Arc } from "./api/arc.js"; import type { Circle } from "./api/circle.js"; import type { Ellipse } from "./api/ellipse.js"; import type { Path } from "./api/path.js"; import type { Quad } from "./api/quad.js"; import { Rect } from "./api/rect.js"; /** * Uniformly rescales & repositions given 2D `shape` such that it fits into * destination bounds. Returns transformed copy of `shape`. * * @param shape * @param dest */ export declare function fitIntoBounds2(shape: Arc, dest: Rect): Path; export declare function fitIntoBounds2(shape: Circle, dest: Rect): Path; export declare function fitIntoBounds2(shape: Ellipse, dest: Rect): Path; export declare function fitIntoBounds2(shape: Rect, dest: Rect): Quad; export declare function fitIntoBounds2<T extends IShape2>(shape: T, dest: Rect): Maybe<T>; /** * 3D version of {@link fitIntoBounds2}. * * @param shape * @param dest */ export declare const fitIntoBounds3: <T extends IShape3>(shape: T, dest: AABB) => Maybe<T>; /** * Version of {@link fitIntoBounds2} for multiple source shapes. * * @param shapes * @param dest */ export declare const fitAllIntoBounds2: (shapes: IShape2[], dest: Rect) => IShape<IShape<any>>[] | undefined; //# sourceMappingURL=fit-into-bounds.d.ts.map