@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
36 lines • 1.03 kB
TypeScript
import type { MultiFn2 } from "@thi.ng/defmulti";
import type { IShape } from "./api.js";
import type { AABB } from "./api/aabb.js";
import { Circle } from "./api/circle.js";
import type { Line } from "./api/line.js";
import { Quad } from "./api/quad.js";
import type { Rect } from "./api/rect.js";
/**
* Function overrides for {@link offset}.
*/
export type OffsetFn = {
(shape: AABB, dist: number): AABB;
(shape: Circle, dist: number): Circle;
(shape: Line, dist: number): Quad;
(shape: Rect, dist: number): Rect;
} & MultiFn2<IShape, number, IShape>;
/**
* Computes an offset shape (as in "path offsetting") of given shape and offset
* distance `dist`.
*
* @remarks
* Also see [thi.ng/geom-sdf](https://thi.ng/thi.ng/geom-sdf) package for more
* flexible & advanced usage.
*
* Currently only implemented for:
*
* - {@link AABB}
* - {@link Circle}
* - {@link Line}
* - {@link Rect}
*
* @param shape
* @param dist
*/
export declare const offset: OffsetFn;
//# sourceMappingURL=offset.d.ts.map