Skip to content

Instantly share code, notes, and snippets.

@wonderburg7
Created March 3, 2019 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wonderburg7/b9e06b9727d5a844ad96038d9898dad4 to your computer and use it in GitHub Desktop.
Save wonderburg7/b9e06b9727d5a844ad96038d9898dad4 to your computer and use it in GitHub Desktop.
float radius = 40;
float x, y, z;
float prevX, prevY;
void setup()
{
size( 700, 700 );
background( 0 );
stroke(255);
strokeWeight( 5 );
x = -radius;
y = -(radius*sin(TWO_PI+((TWO_PI/6)*2)));
prevX = x;
prevY = y;
}
void draw()
{
for (int i = 0; i < (width/radius)+radius; i++){
for (int j = 0; j < (width/radius)+radius; j++){
strokeWeight( 5 );
point(x, y);
strokeWeight( 1 );
line(x, y, x+radius*cos(TWO_PI), y+radius*sin(TWO_PI));
line(x, y, x+radius*cos(TWO_PI+(TWO_PI/6)), y+radius*sin(TWO_PI+(TWO_PI/6)));
line(x, y, x+radius*cos(TWO_PI+((TWO_PI/6)*2)), y+radius*sin(TWO_PI+((TWO_PI/6)*2)));
x += radius;
}
y = y+radius*sin(TWO_PI+((TWO_PI/6)*2));
z++;
if (z % 2 == 0){
x = -(radius/2);
} else {
x = -radius;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment