Pentagonal Tesselation

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()
7 Likes

Happy New Year Alexandre ! Thank you for sharing this, I really like the colors you used.

And of course, Happy New Year to everyone. Special thoughts for our small Python enthusiasts community.

2 Likes

Thanks! But I have to admit that I imitated the colors from the example at the Wikipedia article! :smiley:

1 Like

I could not resist having a go with JRubyArt and py5 (which is a bit too similar at present so I don’t show it here). Here’s JRubyArt version:-

ANGLE = PI / 2
PTS = [Vec2D.new(-30, 0), Vec2D.new(30, 0), Vec2D.new(45, 45), Vec2D.new(0, 60), Vec2D.new(-45, 45)]
S = 15
W = 12 * S
H = 6 * S

def settings
  size(W * 3, H * 6)
end

def setup
  sketch_title 'Cairo tiling'
  @renderer ||= GfxRender.new(g)
  cols = width + W
  rows = height + H
  grid(cols, rows, W, H) do |x, y|
     (y % W).zero? ? composite_tile(x + W / 2, y, S) : composite_tile(x, y, S)
  end
end

def composite_tile(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)
end

def pentagon(xo, yo, s, r = 0)
  push_matrix
  translate(xo, yo)
  rotate(ANGLE * r)
  begin_shape
  PTS.map { |vec| vec.to_vertex(@renderer) }
  end_shape
  pop_matrix
end

Makes use of ruby-processing grid function and vector to vertex function (I think py5 probably has something similar with new vector class).

1 Like