@thi.ng/geom-axidraw
Version:
Conversion and preparation of thi.ng/geom shapes & shape groups to/from AxiDraw pen plotter draw commands
50 lines • 2.06 kB
TypeScript
import type { IShape2 } from "@thi.ng/geom";
import type { IRegionQuery, ISpatialMap, ISpatialSet } from "@thi.ng/geom-accel";
import { type ReadonlyVec } from "@thi.ng/vectors/api";
import type { PointOrdering, ShapeOrdering } from "./api.js";
/**
* Higher order point ordering fn. Adds points to given spatial
* index/acceleration structure and then lazily sorts them by nearest neighbor
* distance, starting selection of first point based on given `ref` point
* (default: `[0,0]`).
*
* @remarks
* By default is using a
* [`KdTreeSet`](https://docs.thi.ng/umbrella/geom-accel/classes/KdTreeSet.html)
* to index all points and then successively perform efficient nearest neighbor
* searches (always w.r.t the most recent result point).
*
* @param accel
* @param ref
*/
export declare const pointsByNearestNeighbor: (accel?: ISpatialSet<ReadonlyVec> & IRegionQuery<ReadonlyVec, ReadonlyVec, number>, ref?: ReadonlyVec) => PointOrdering;
/**
* Higher order point ordering fn. Sorts points by proximity to given `ref`
* point (default: `[0,0]`).
*
* @param ref
*/
export declare const pointsByProximity: (ref?: ReadonlyVec) => PointOrdering;
/**
* Higher order shape sorting fn. Sorts shapes by their centroid's proximity to
* given `ref` point (default: `[0,0]`).
*
* @param ref
*/
export declare const shapesByProximity: (ref?: ReadonlyVec) => ShapeOrdering;
/**
* Similar to {@link pointsByNearestNeighbor}, however for shapes and requiring
* an
* [`ISpatialMap`](https://docs.thi.ng/umbrella/geom-accel/interfaces/ISpatialMap.html)
* implementation and is using shape centroid (auto-computed) to perform
* indexing and nearest neighbor queries.
*
* @remarks
* Currently recommended to use
* [`NdQuadtreeMap`](https://docs.thi.ng/umbrella/geom-accel/classes/NdQuadtreeMap.html).
*
* @param accel
* @param ref
*/
export declare const shapesByNearestNeighbor: (accel: ISpatialMap<ReadonlyVec, IShape2> & IRegionQuery<ReadonlyVec, IShape2, number>, ref?: ReadonlyVec) => ShapeOrdering;
//# sourceMappingURL=sort.d.ts.map