skew alternate tiling
@author
float e = 20;
float theta = PI / 4;
float margin = 50;
void setup(){
size(500, 500);
mousePressed();
}
void draw(){
}
void mousePressed(){
fill(random(255), random(255), random(255));
stroke(random(255), random(255), random(255));
strokeWeight(5);
boolean isToRight = true;
float h = -margin;
while(h < height + margin){
for(float w = -margin; w < width + margin; w += e * 2 / sqrt(2)){
pushMatrix();
if(isToRight){
translate(w, h);
rotate(theta);
} else {
translate(w + e / sqrt(2), h);
rotate(theta + PI / 2);
}
rect(0, 0, 2 * e, e);
popMatrix();
}
h += isToRight ? e * 3 / sqrt(2): e / sqrt(2);
isToRight = !isToRight;
}
}