wonderburg7
3/3/2019 - 5:16 PM

triangular grid lines.pde

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; 
   }
  }
  
 
}