@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
73 lines • 2.88 kB
TypeScript
import type { MultiFn3O } from "@thi.ng/defmulti";
import type { IShape, IShape2, IShape3 } from "./api.js";
import type { ComplexPolygon } from "./api/complex-polygon.js";
import type { Group } from "./api/group.js";
import type { Group3 } from "./api/group3.js";
import type { Polygon } from "./api/polygon.js";
import type { Polygon3 } from "./api/polygon3.js";
import type { Polyline } from "./api/polyline.js";
import type { Polyline3 } from "./api/polyline3.js";
/**
* Function overrides for {@link convolve}.
*/
export type ConvoleFn = {
(shape: ComplexPolygon, kernel: number[], t?: number, iter?: number): ComplexPolygon;
(shape: Group, kernel: number[], t?: number, iter?: number): Group;
(shape: Group3, kernel: number[], t?: number, iter?: number): Group3;
(shape: Polygon, kernel: number[], t?: number, iter?: number): Polygon;
(shape: Polygon3, kernel: number[], t?: number, iter?: number): Polygon3;
(shape: Polyline, kernel: number[], t?: number, iter?: number): Polyline;
(shape: Polyline3, kernel: number[], t?: number, iter?: number): Polyline3;
<T extends IShape2>(shape: IShape2, kernel: number[], t?: number, iter?: number): T;
<T extends IShape3>(shape: IShape3, kernel: number[], t?: number, iter?: number): T;
} & MultiFn3O<IShape, number[], number, number, IShape>;
/**
* Convolves the vertices of `shape` with given `kernel` and returns updated
* shape of same type. The kernel is applied symmetrical to each vertex and its
* neighbors (i.e. neighbors on both sides).
*
*
* @remarks
* Implementations:
*
* - [`convolveClosed`](https://docs.thi.ng/umbrella/geom-poly-utils/functions/convolveClosed.html))
* - [`convolveOpen`](https://docs.thi.ng/umbrella/geom-poly-utils/functions/convolveOpen.html))
*
* Currently only implemented for:
*
* - {@link ComplexPolygon}
* - {@link Group} (if only containing supported shapes)
* - {@link Group3} (if only containing supported shapes)
* - {@link Polygon}
* - {@link Polyline}
*
* Use {@link asPolygon} or {@link asPolyline} to convert other shape types
* first.
*
* Available preset kernels:
*
* - {@link KERNEL_BOX}
* - {@link KERNEL_TRIANGLE}
* - {@link KERNEL_GAUSSIAN}
*
* @param shape
* @param k
* @param t
*/
export declare const convolve: ConvoleFn;
/**
* Re-export of
* [`KERNEL_BOX`](https://docs.thi.ng/umbrella/geom-poly-utils/variables/KERNEL_BOX.html).
*/
export declare const KERNEL_BOX: (k: number) => any[];
/**
* Re-export of
* [`KERNEL_TRIANGLE`](https://docs.thi.ng/umbrella/geom-poly-utils/variables/KERNEL_TRIANGLE.html).
*/
export declare const KERNEL_TRIANGLE: (k: number) => number[];
/**
* Re-export of
* [`KERNEL_GAUSSIAN`](https://docs.thi.ng/umbrella/geom-poly-utils/variables/KERNEL_GAUSSIAN.html).
*/
export declare const KERNEL_GAUSSIAN: (k: number) => number[];
//# sourceMappingURL=convolve.d.ts.map