Push-Heal Rectangulation
Deterministic rectangulation generator for an integer grid. It subdivides
[0..N] x [0..N] into axis-aligned rectangles using a local
push-heal operation.
Contract
- Integer coordinates only.
- Bounding square is
(0,0)to(N,N). - All edges are axis-aligned.
- Rectangles fully tile the square with no overlap.
Deterministic behavior: same version + same options + same seed = same output.
Install
npm i push-heal-rectangulation
Quickstart
import { createGenerator } from "push-heal-rectangulation";
const gen = createGenerator({
size: 60,
seed: "12345",
bootstrapRect: { width: 2, height: 2 },
hopStrategy: "random",
prioritizePotential: false,
includeSegments: true,
recordSteps: false,
});
const out = gen.run();
for (const r of out.rects) {
// primary output
}
License
MIT