Skip to the plate
FORMA PUBLIC DOMAIN GENERATIVE ATLAS / ED. 0.28
Plate 53, Hitomezashi Stitching: a still of the stitching / parity rule plate as the atlas renders it, in the lattices accent.

PL. 53  ·  LATTICES / STITCHING / PARITY RULE

Hitomezashi Stitching

Traditional Japanese sashiko · Edo period onward

OPEN THE LIVE PLATE ▸

DEFINITION

rows: stitch where (i + aⱼ) is even
columns: stitch where (j + bᵢ) is even
a, b ∈ {0,1} — two random sequences

NOTES

Hitomezashi — "one-stitch" sashiko — sews single running stitches along the lines of a grid, and the entire cloth is determined by one bit per row and one bit per column: does that line start on or off. From those two coin-flip sequences, staircases, loops and long wandering paths emerge — structures the sewers of Edo-period Japan knew by eye long before percolation theory had names for them. Regenerate re-rolls the sequences.

PROVENANCE

Origin
Japanese needlework tradition; the parity description is the folk rule written down
Standing
Public domain — a craft pattern centuries old
Constants
Bias skews the two coin flips; at 0 or 1 the cloth collapses to stripes

HOUDINI · VEX

The same published mathematics as a Detail Wrangle body. Paste it into a Wrangle with Run Over set to Detail; every constant is the published value plus a tweak channel, so Create Spare Parameters gives a slider that starts where the paper does.

// FORMA — PL. 53 · HITOMEZASHI STITCHING — Traditional Japanese sashiko · Edo period onward
//   rows: stitch where (i + aⱼ) is even
//   columns: stitch where (j + bᵢ) is even
//   a, b ∈ {0,1} — two random sequences
// Paste into a Detail Wrangle (Run Over: Detail), no inputs needed.
// Written from the published mathematics, not adapted from any code.
// Constants arrive at their published values. Press the node's Create
// Spare Parameters button and every tweak becomes a slider — starting
// at 0, the published figure, and moving in the constant's own units.
// https://forma-gen.com/#plate=hitomezashi

float p_grid = 30 + chf('grid_tweak');      // cells across · live 16 .. 48
float p_bias = 0.5 + chf('bias_tweak');     // sequence bias · live 0.1 .. 0.9

// The plate's own colour: FORMA's LATTICES accent as a cosine ramp,
// brightest near t = 0 and t = 1, near-black around t = 0.5.
vector forma_ramp(float t){
  return set(
    0.46 + 0.5 * cos(6.28318530718 * (t + 0)),
    0.4185 + 0.4549 * cos(6.28318530718 * (t + 0.05)),
    0.1389 + 0.151 * cos(6.28318530718 * (t + 0.1)));
}

// One-stitch sashiko: one bit per row and one per column, a stitch on every
// grid line where the parity says so — the entire cloth from two coin-flip
// sequences, drawn on the plate's own seed so every cook sews the same one.
// Each stitch is a two-point polyline in lattice units; the horizontal and
// vertical threads sit on the plate's two different steps of the ramp's
// bright lobe, which is what makes the weave read as two threads.
//
// The plate cuts its cloth to the card's aspect (rows from height over cell
// size) and sews it over its clock with a HILITE needle head; the port sews
// a square cloth of grid × grid cells, finished, no needle. The bit
// sequences are drawn in the plate's own order — all row bits, then all
// column bits — so the square cloth is the top-left of the plate's own
// fabric wherever the aspects agree.
int n = int(rint(p_grid));
int rows = n;

int rc = 431;                     // the plate's own seed, counted upward
int a[], b[];
for (int j = 0; j <= rows; j++){ push(a, random(rc) < p_bias ? 1 : 0);  rc++; }
for (int i = 0; i <= n;    i++){ push(b, random(rc) < p_bias ? 1 : 0);  rc++; }

// horizontal passes first, top to bottom — the order a needle would take
vector hcol = forma_ramp(0.88);
for (int j = 0; j <= rows; j++){
    for (int i = 0; i < n; i++){
        if ((i + a[j]) % 2 != 0) continue;
        // canvas y runs down; negated so the cloth hangs as the plate shows it
        int p0 = addpoint(0, set(float(i),     -float(j), 0.0));
        int p1 = addpoint(0, set(float(i + 1), -float(j), 0.0));
        setpointattrib(0, "Cd", p0, hcol);  setpointattrib(0, "Cd", p1, hcol);
        setpointattrib(0, "Alpha", p0, 0.85);  setpointattrib(0, "Alpha", p1, 0.85);
        addprim(0, "polyline", p0, p1);
    }
}
// then the vertical passes, left to right
vector vcol = forma_ramp(1.02);
for (int i = 0; i <= n; i++){
    for (int j = 0; j < rows; j++){
        if ((j + b[i]) % 2 != 0) continue;
        int p0 = addpoint(0, set(float(i), -float(j),     0.0));
        int p1 = addpoint(0, set(float(i), -float(j + 1), 0.0));
        setpointattrib(0, "Cd", p0, vcol);  setpointattrib(0, "Cd", p1, vcol);
        setpointattrib(0, "Alpha", p0, 0.85);  setpointattrib(0, "Alpha", p1, 0.85);
        addprim(0, "polyline", p0, p1);
    }
}

AFTER EFFECTS · DECLINED

Every stitch point has degree two, so the pattern is disjoint loops and runs; a row is a dash pattern, which in After Effects is a stroke setting, not geometry.