UNPKG

@thi.ng/grid-iterators

Version:

2D grid and shape iterators w/ multiple orderings

42 lines 1.29 kB
import type { GridIterOpts2D } from "./api.js"; export interface InterleaveOpts2D extends GridIterOpts2D { /** * Row or column stride. * * @defaultValue 2 */ step?: number; } /** * Yields 2D grid coordinates in the order of interleaved columns with * configurable `step` size (default: 2). * * @remarks * Returns columns in this order: * * - 0, step, 2 * step, 3 * step... * - 1, 2 * step + 1, 3 * step + 1... * - etc. * * Also see {@link interleaveRows2d}. * * @param opts - */ export declare const interleaveColumns2d: (opts: InterleaveOpts2D) => Generator<import("./api.js").GridCoord2D, void, any>; /** * Similar to {@link interleaveColumns2d}, but yields 2D grid coordinates in * the order of interleaved rows with configurable `step` size (default: * 2). * * @remarks * Returns rows in this order: * * - 0, step, 2 * step, 3 * step... * - 1, 2 * step + 1, 3 * step + 1... * - etc. * * @param opts - */ export declare const interleaveRows2d: (opts: InterleaveOpts2D) => Generator<import("./api.js").GridCoord2D, void, any>; export declare function __interleave(opts: InterleaveOpts2D, order: [number, number], [x, y]: [number, number]): Generator<import("./api.js").GridCoord2D, void, any>; //# sourceMappingURL=interleave.d.ts.map