Last active
February 10, 2023 18:27
-
-
Save cyber-murmel/dac6bc45837174078367bba83384b018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size = 1; | |
dx = 25; | |
dy = 25; | |
module striped_square(size = 1, length = 1, num_stripes = 2) { | |
color("teal") | |
for(stripe = [1:num_stripes]) { | |
if((stripe % 2) == 1) { | |
polygon([[stripe-1, 0], [stripe,0], [0, stripe], [0,stripe-1]]*size/num_stripes); | |
} | |
} | |
color("green") | |
for(stripe = [num_stripes:length*num_stripes]) { | |
if((stripe % 2) == 1) { | |
polygon([[stripe-1, 0], [stripe,0], [stripe-num_stripes, num_stripes], [stripe-1-num_stripes,num_stripes]]*size/num_stripes); | |
} | |
} | |
color("turquoise") | |
for(stripe = [length*num_stripes:(length+1)*num_stripes]) { | |
if((stripe % 2) == 1) { | |
polygon([[length*num_stripes, stripe-length*num_stripes-1], [length*num_stripes,stripe-length*num_stripes], [stripe-num_stripes, num_stripes], [stripe-num_stripes-1,num_stripes]]*size/num_stripes); | |
} | |
} | |
} | |
module houndstooth(size = 1, dx = 2, dy = 2) { | |
nx = ceil((dx/size) / 2); | |
ny = ceil((dy/size) / 2); | |
union() { | |
for (y = [0: ny-1]) { | |
translate(([0, y] * size * 2)) | |
striped_square(size, 2*nx, 2); | |
} | |
for (x = [0: nx-1]) { | |
translate( | |
([x, 0] * size * 2) | |
+ ([1, 2*ny] * size) | |
) | |
mirror([1, 1]) | |
striped_square(size, 2*ny, 2); | |
} | |
} | |
} | |
houndstooth(size, dx, dy); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment