@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
69 lines • 2.13 kB
TypeScript
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { CubicOpts, IShape, IShape2, IShape3 } from "./api.js";
import { Cubic } from "./api/cubic.js";
import { Cubic3 } from "./api/cubic3.js";
export interface AsCubicOpts extends CubicOpts {
attribs: boolean;
}
/**
* Function overrides for {@link asCubic}.
*/
export type AsCubicFn = {
<T extends IShape2>(shape: T, opts?: Partial<AsCubicOpts>): Cubic[];
<T extends IShape3>(shape: T, opts?: Partial<AsCubicOpts>): Cubic3[];
} & MultiFn1O<IShape, Partial<AsCubicOpts>, (Cubic | Cubic3)[]>;
/**
* Converts given shape boundary into an array of {@link Cubic} or
* {@link Cubic3} curves. For some shapes (see below) the conversion supports
* optionally provided {@link CubicOpts}.
*
* @remarks
* Currently implemented for:
*
* - {@link Arc}
* - {@link BPatch}
* - {@link Circle}
* - {@link ComplexPolygon}
* - {@link Cubic}
* - {@link Cubic3}
* - {@link Ellipse}
* - {@link Group}
* - {@link Group3}
* - {@link Line}
* - {@link Line3}
* - {@link Path}
* - {@link Path3}
* - {@link Polygon}
* - {@link Polygon3}
* - {@link Polyline}
* - {@link Polyline3}
* - {@link Quad}
* - {@link Quad3}
* - {@link Quadratic}
* - {@link Quadratic3}
* - {@link Rect}
* - {@link Triangle}
* - {@link Triangle3}
*
* Shape types supporting custom conversion options (see
* [@thi.ng/geom-splines](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-splines#cubic-curve-conversion-from-polygons--polylines)
* for more details):
*
* - {@link Group} (only used for eligible children)
* - {@link Group3} (only used for eligible children)
* - {@link ComplexPolygon}
* - {@link Polygon}
* - {@link Polygon3} (no support for mode: "break" or "hobby")
* - {@link Polyline}
* - {@link Polyline3} (no support for mode: "break" or "hobby")
* - {@link Quad}
* - {@link Quad3} (no support for mode: "break" or "hobby")
* - {@link Rect}
* - {@link Triangle}
* - {@link Triangle3} (no support for mode: "break" or "hobby")
*
* @param shape
* @param opts
*/
export declare const asCubic: AsCubicFn;
//# sourceMappingURL=as-cubic.d.ts.map