@thi.ng/geom
Version:
Functional, polymorphic API for 2D geometry types & SVG generation
33 lines • 1.13 kB
TypeScript
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { CubicOpts, IShape, IShape2, IShape3 } from "./api.js";
import { Path } from "./api/path.js";
import { Path3 } from "./api/path3.js";
export interface AsPathOpts extends CubicOpts {
/**
* If true (default: false), creates path consisting of linear segments
* only.
*/
linear: boolean;
}
/**
* Function overrides for {@link asPath}.
*/
export type AsPathFn = {
(shape: IShape2, opts?: Partial<AsPathOpts>): Path;
(shape: IShape3, opts?: Partial<AsPathOpts>): Path3;
} & MultiFn1O<IShape, Partial<AsPathOpts>, Path | Path3>;
/**
* Converts given shape boundary into a {@link Path} (by default via
* {@link asCubic} and {@link pathFromCubics}).
*
* @remarks
* If {@link AsPathOpts.linear} is enabled the shape will be converted into a
* path consisting only of linear segments (NOT cubic beziers). As an interim
* step this will involve a conversion via {@link asPolygon} or
* {@link asPolyline} with default opts.
*
* @param src
* @param opts
*/
export declare const asPath: AsPathFn;
//# sourceMappingURL=as-path.d.ts.map