@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
46 lines • 1.47 kB
TypeScript
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { IShape, IShape2, IShape3, SamplingOpts } from "./api.js";
import { Polygon } from "./api/polygon.js";
import { Polygon3 } from "./api/polygon3.js";
/**
* Function overrides for {@link asPolygon}.
*/
export type AsPolygonFn = {
(shape: IShape2, opts?: number | Partial<SamplingOpts>): Polygon[];
(shape: IShape3, opts?: number | Partial<SamplingOpts>): Polygon3[];
} & MultiFn1O<IShape, number | Partial<SamplingOpts>, (Polygon | Polygon3)[]>;
/**
* Converts given shape boundary into an array of {@link Polygon}s or
* {@link Polygon3}, optionally using provided
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom/interfaces/SamplingOpts.html)
* or number of target vertices.
*
* @remarks
* If the input shape has a `__samples` attribute, it will be removed in the
* results polys to avoid recursive application.
*
* Currently implemented for:
*
* - {@link Arc}
* - {@link Circle}
* - {@link ComplexPolygon}
* - {@link Ellipse}
* - {@link Line} (will be closed)
* - {@link Line3} (will be closed)
* - {@link Path}
* - {@link Path3}
* - {@link Polygon}
* - {@link Polygon3}
* - {@link Polyline} (will be closed)
* - {@link Polyline3} (will be closed)
* - {@link Quad}
* - {@link Quad3}
* - {@link Rect}
* - {@link Triangle}
* - {@link Triangle3}
*
* @param shape
* @param opts
*/
export declare const asPolygon: AsPolygonFn;
//# sourceMappingURL=as-polygon.d.ts.map