Unbalanced anisohedral tile
Generates the tiling described in angelfire.com/mn3/anisohedral/unbalanced.html
The tiling is "unbalanced" because the transitivity classes of the tiles are in a 2:1 ratio.
Log in to post a comment.
const side_length = 5; //min=1 max=20 step=1
//compute based on the side length how many iterations we need vertically
const tile_count = 1 + (28 - (28 % side_length)) / side_length;
Canvas.setpenopacity(-1);
// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(-100,-100);
turtle.pendown();
function draw_side(length) {
turtle.forward(length);
}
function trace_hex_perimeter(sides, dir) {
turtle.right(dir);
while(sides > 0) {
draw_side(side_length)
turtle.right(60);
sides = sides - 1;
}
}
function draw_tee(dir) {
turtle.pendown();
trace_hex_perimeter(3,dir)
for (sides of [2,5,1,1,2,5,2,1,1,5,2]) {
trace_hex_perimeter(sides,-120)
}
turtle.penup();
//reset facing to initial angle
turtle.left(120+dir);
}
function walk_hex_grid(a,b) {
//step distances along lattice that follows hex grid
turtle.forward(side_length*a);
turtle.right(120);
turtle.forward(side_length*b);
turtle.right(240);
// direction c = b-a
}
// The walk function will be called until it returns false.
function walk(i) {
//draw six tees to form a monohedral tile
draw_tee(-60)
walk_hex_grid(-6,2)
draw_tee(-120)
walk_hex_grid(9,4)
draw_tee(60)
walk_hex_grid(4,2)
draw_tee(180)
walk_hex_grid(8,0)
draw_tee(120)
walk_hex_grid(-7,-8)
draw_tee(0)
//jump to the next iteration
walk_hex_grid(-4,8)
if (i % tile_count == tile_count - 1) {
//jump 18 across to the next column and back up to the top
walk_hex_grid(18,0)
turtle.sety(-100)
}
return i < tile_count * tile_count;
}