Happy New Year everyone!
I hope you enjoy some tiling with pentagons.
More ideas here: https://math.dartmouth.edu/~mutzel/pentagonal_tiling.pdf
And here: Cairo pentagonal tiling - Wikipedia
def setup():
size(180 * 3, 90 * 6)
s = 15
w, h = 12 * s, 6 * s
cols = width // w
rows = height // h
for i in range(cols + 1):
x = i * w
for j in range(rows + 1):
y = j * h
if j % 2:
module(x, y, s)
else:
module(x + w / 2, y, s)
def module(x, y, s):
fill(255, 220, 0)
pentagon(x, y, s)
fill(255, 220, 155)
pentagon(x + 6 * s, y, s, r=1)
fill(0, 100, 200)
pentagon(x - 6 * s, y, s, r=3)
fill(140, 180, 255)
pentagon(x, y, s, r=2)
def pentagon(xo, yo, s, r=0):
pts = ((-2, 0), (2, 0), (3, 3), (0, 4), (-3, 3))
pushMatrix()
translate(xo, yo)
rotate(HALF_PI * r)
beginShape()
for x, y in pts:
vertex(x * s, y * s)
endShape(CLOSE)
popMatrix()