UNPKG

@thi.ng/geom

Version:

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

47 lines 1.46 kB
import type { MultiFn1O } from "@thi.ng/defmulti"; import type { IShape, IShape2, IShape3, SamplingOpts } from "./api.js"; import { Polyline } from "./api/polyline.js"; import { Polyline3 } from "./api/polyline3.js"; /** * Function overrides for {@link asPolyline}. */ export type AsPolylineFn = { <T extends IShape2>(shape: T, opts?: number | Partial<SamplingOpts>): Polyline[]; <T extends IShape3>(shape: T, opts?: number | Partial<SamplingOpts>): Polyline3[]; } & MultiFn1O<IShape, number | Partial<SamplingOpts>, (Polyline | Polyline3)[]>; /** * Converts given shape boundary into an array of {@link Polyline}s or * {@link Polyline3}, optionally using provided * [`SamplingOpts`](https://docs.thi.ng/umbrella/geom/interfaces/SamplingOpts.html) * or number of target vertices. * * @remarks * If the shape has a `__samples` attribute, it will be removed in the results * to avoid recursive application. * * Currently implemented for: * * - {@link Arc} * - {@link Circle} * - {@link ComplexPolygon} * - {@link Cubic} * - {@link Ellipse} * - {@link Line} * - {@link Path} * - {@link Polygon} * - {@link Polygon3} * - {@link Polyline} * - {@link Polyline3} * - {@link Quad} * - {@link Quad3} * - {@link Quadratic} * - {@link Quadratic3} * - {@link Rect} * - {@link Triangle} * - {@link Triangle3} * * @param shape * @param opts */ export declare const asPolyline: AsPolylineFn; //# sourceMappingURL=as-polyline.d.ts.map