{{ message }}

Instantly share code, notes, and snippets.

# justvanrossum/PaulBrownPattern.py

Last active Mar 11, 2020
DrawBot script to recreate 'Untitled Computer Assisted Drawing' by Paul Brown from 1975
 # Original: # Paul Brown, 'Untitled Computer Assisted Drawing' (1975) # The program was written in Fortran and drawn with Calcomp's drum pen plotter. # https://twitter.com/satoshi_aizawa/status/1218786881631965186 def drawArc(center, radius, startAngle, endAngle): bez = BezierPath() bez.arc(center, radius, startAngle, endAngle, False) drawPath(bez) def tile1(x, y, q=0): with savedState(): translate(x, y) rotate(q * 90, center=(0.5, 0.5)) for r in [0.2, 0.4, 0.6, 0.8]: drawArc((0, 0), r, 0, 90) if r == 0.8: drawArc((1, 1), r, 180, 198) drawArc((1, 1), r, 252, 270) else: drawArc((1, 1), r, 180, 270) def tile2(x, y): tile1(x, y, 1) def tile3(x, y): tile1(x, y, 2) def tile4(x, y): tile1(x, y, 3) def tile5(x, y): with savedState(): translate(x, y) for i in range(4): drawArc((0, 0.5), 0.1, 270, 90) drawArc((0, 0.5), 0.3, 270, 90) rotate(90, center=(0.5, 0.5)) def tile6(x, y): with savedState(): translate(x, y) oval(0.3, 0.3, 0.4, 0.4) for i in range(4): drawArc((0, 0), 0.2, 0, 90) drawArc((0, 0), 0.4, 0, 90) rotate(90, center=(0.5, 0.5)) allTiles = [tile1, tile2, tile3, tile4, tile5, tile6] numTiles = 16 fill(1) rect(0, 0, 1000, 1000) # white background scale(1000 / numTiles) scale(0.9, center=(numTiles/2, numTiles/2)) fill(None) stroke(0) strokeWidth(0.05) rect(0, 0, numTiles, numTiles) strokeWidth(0.1) for i in range(numTiles): for j in range(numTiles): tile = choice(allTiles) tile(i, j) saveImage("PaulBrownPattern.png")