@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
43 lines • 1.24 kB
TypeScript
import type { Maybe } from "@thi.ng/api";
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { AABBLike, IShape, IShape2, IShape3 } from "./api.js";
import type { AABB } from "./api/aabb.js";
import { Rect } from "./api/rect.js";
/**
* Function overrides for {@link bounds}.
*/
export type BoundsFn = {
(shape: IShape2, margin?: number): Maybe<Rect>;
(shape: IShape3, margin?: number): Maybe<AABB>;
} & MultiFn1O<IShape, number, Maybe<AABBLike>>;
/**
* Computes and returns bounding rect/box for the given shape, optionally with
* extra uniform margin/padding (default: 0). For groups, the compound bounds of
* all children will be returned.
*
* @remarks
* Currently implemented for:
*
* - {@link AABB}
* - {@link Arc}
* - {@link BPatch}
* - {@link Circle}
* - {@link Cubic}
* - {@link Ellipse}
* - {@link Extra} (returns `undefined`)
* - {@link Group}
* - {@link Line}
* - {@link Path}
* - {@link Polygon}
* - {@link Polyline}
* - {@link Points}
* - {@link Points3}
* - {@link Quad}
* - {@link Quadratic}
* - {@link Text} - (no way to compute size, only position & any margin)
*
* @param shape
* @param margin
*/
export declare const bounds: BoundsFn;
//# sourceMappingURL=bounds.d.ts.map