patterns — truchet

generator verdict no votes yet
source — auto/a000_truchet.g50_truchet
def g50_truchet(rng):
    """TRUCHET — a two-tile set placed by a biased coin, quarter-arcs approximated
    by nested diamonds so continuous curves emerge across the lattice."""
    N = 32
    c = Canvas(N, "GEOMETRIC", "diamond", "truchet", tiles=True)
    C = c.C
    nz = Value2D(rng, res=rng.choice([3, 4, 5]))
    tilt = rng.uniform(0.1, 0.6)
    grow = rng.uniform(0.30, 0.46)
    for i in range(N):
        for j in range(N):
            u, v = (i + 0.5) / N, (j + 0.5) / N
            p = clamp(nz(u, v) * (1 - tilt) + u * tilt)
            x, y = c.center(i, j)
            r = grow * C * (0.7 + 0.6 * p)
            if rng.random() < p:
                c.diamond(x, y, r, rot=45)
            else:
                c.rect(x, y, r * 1.4, r * 1.4, rot=rng.choice([0, 45]))
    return c
truchet-diamond-32-2bff
truchet-diamond-32-2bff
truchet-diamond-32-c713
truchet-diamond-32-c713
truchet-diamond-32-8dc5
truchet-diamond-32-8dc5
truchet-diamond-32-703c
truchet-diamond-32-703c
truchet-diamond-32-2cfa
truchet-diamond-32-2cfa
truchet-diamond-32-d02f
truchet-diamond-32-d02f
truchet-diamond-32-7759
truchet-diamond-32-7759
truchet-diamond-32-d510
truchet-diamond-32-d510
truchet-diamond-32-f24a
truchet-diamond-32-f24a
truchet-diamond-32-c92a
truchet-diamond-32-c92a
truchet-diamond-32-76fd
truchet-diamond-32-76fd
truchet-diamond-32-f868
truchet-diamond-32-f868
truchet-diamond-32-c217
truchet-diamond-32-c217
truchet-diamond-32-183f
truchet-diamond-32-183f

generator