@thi.ng/geom-axidraw
Version:
Conversion and preparation of thi.ng/geom shapes & shape groups to/from AxiDraw pen plotter draw commands
56 lines • 1.58 kB
TypeScript
import type { DrawCommand } from "@thi.ng/axidraw/api";
import type { MultiFn1O } from "@thi.ng/defmulti";
import type { IShape2 } from "@thi.ng/geom";
import type { AsAxiDrawOpts } from "./api.js";
/**
* Lazily converts given shape (or group) into an iterable of thi.ng/axidraw
* drawing commands, using optionally provided config options.
*
* @remarks
* The provided conversion options can (and will) be overridden by a shape's
* `__axi` attribute. See {@link AxiDrawAttribs} for details.
*
* Currently supported shape types (at least all types which are supported by
* the
* [`asPolyline`](https://docs.thi.ng/umbrella/geom/functions/asPolyline.html)
* function):
*
* - arc
* - circle
* - complexpoly
* - cubic
* - ellipse
* - group
* - line
* - path
* - points
* - polygon
* - polyline
* - quad
* - quadratic
* - rect
* - triangle
*
* @example
* ```ts tangle:../export/as-axidraw.ts
* import { circle } from "@thi.ng/geom";
* import { asAxiDraw } from "@thi.ng/geom-axidraw";
*
* console.log(
* [...asAxiDraw(circle(100), { samples: 6 })]
* );
* // [
* // [ "M", [ 100, 0 ], 1 ],
* // [ "d", undefined, undefined ],
* // [ "M", [ 50.00, 86.60 ], 1 ],
* // [ "M", [ -49.99, 86.60 ], 1 ],
* // [ "M", [ -100, 0 ], 1 ],
* // [ "M", [ -50.00, -86.60 ], 1 ],
* // [ "M", [ 49.99, -86.60 ], 1 ],
* // [ "M", [ 100, 0 ], 1 ],
* // [ "u", undefined, undefined ]
* // ]
* ```
*/
export declare const asAxiDraw: MultiFn1O<IShape2, Partial<AsAxiDrawOpts>, Iterable<DrawCommand>>;
//# sourceMappingURL=as-axidraw.d.ts.map