@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
31 lines • 918 B
TypeScript
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { IShape, IShape2 } from "./api.js";
/**
* Function overrides for {@link simplify}.
*/
export type SimplifyFn = {
<T extends IShape2>(shape: IShape2, eps?: number): T;
} & MultiFn1O<IShape, number, IShape>;
/**
* Simplifies given 2D shape boundary using Douglas-Peucker algorithm
* (implemented by
* [`simplify`](https://docs.thi.ng/umbrella/geom-resample/functions/simplify.html))
* and given `threshold` distance (default: 1e-6, which removes only co-linear
* vertices).
*
* @remarks
* Currently only implemented for:
*
* - {@link ComplexPolygon}
* - {@link Path}
* - {@link Polygon}
* - {@link Polyline}
*
* Use {@link asPath}, {@link asPolygon} or {@link asPolyline} to convert other
* shape types first.
*
* @param shape
* @param threshold
*/
export declare const simplify: SimplifyFn;
//# sourceMappingURL=simplify.d.ts.map