open iterations #0001

The prompt:

Divide the drawing surface into four horizontal parts. In the top row are four equal divisions, each with lines in a different direction and color (Sol chose red, yellow, blue, and black colored pencil to mimic the CYMK of printing presses). In the second row, six equal divisions with each containing a combination of two of the colors/directions; in the third row, four equal divisions containing combinations of three colors/directions; in the bottom row, all four combinations superimposed. Consider how your choice of density or thickness of parallel lines will impact the blending of the colors. Use any drawing medium you like, including analog, digital, or code-based media.

jason

int numLines = 333;
float angle;
PGraphics cTex, mTex, yTex, kTex;
 
void setup() {
  size(1000, 1000, P2D);
  cTex = createGraphics(width, height);
  mTex = createGraphics(width, height);
  yTex = createGraphics(width, height);
  kTex = createGraphics(width, height);
  color cyan = #00FFFF;
  color magenta = #FF00FF;
  color yellow = #FFFF00;
  color black = #000000;
  angle = 0;
  drawLines(cTex, angle, numLines, cyan);
  angle = 45;
  drawLines(mTex, angle, numLines, magenta);
  angle = 90;
  drawLines(yTex, angle, numLines, yellow);
  angle = 135;
  drawLines(kTex, angle, numLines, black);
}
 
void draw() {
  background(255);
  // row 1
  drawQuad(0, 0, 250, 0, 250, 250, 0, 250, cTex);
  drawQuad(250, 0, 500, 0, 500, 250, 250, 250, mTex);
  drawQuad(500, 0, 750, 0, 750, 250, 500, 250, yTex);
  drawQuad(750, 0, 1000, 0, 1000, 250, 750, 250, kTex);
  // row 2
  drawQuad(0, 250, 166, 250, 166, 500, 0, 500, cTex);
  drawQuad(0, 250, 166, 250, 166, 500, 0, 500, mTex);
  drawQuad(166, 250, 332, 250, 332, 500, 166, 500, cTex);
  drawQuad(166, 250, 332, 250, 332, 500, 166, 500, yTex);
  drawQuad(332, 250, 498, 250, 498, 500, 332, 500, cTex);
  drawQuad(332, 250, 498, 250, 498, 500, 332, 500, kTex);
  drawQuad(498, 250, 664, 250, 664, 500, 498, 500, mTex);
  drawQuad(498, 250, 664, 250, 664, 500, 498, 500, yTex);
  drawQuad(664, 250, 832, 250, 832, 500, 664, 500, mTex);
  drawQuad(664, 250, 832, 250, 832, 500, 664, 500, kTex);
  drawQuad(832, 250, 1000, 250, 1000, 500, 832, 500, yTex);
  drawQuad(832, 250, 1000, 250, 1000, 500, 832, 500, kTex);
  // row 3
  drawQuad(0, 500, 250, 500, 250, 750, 0, 750, cTex);
  drawQuad(0, 500, 250, 500, 250, 750, 0, 750, mTex);
  drawQuad(0, 500, 250, 500, 250, 750, 0, 750, yTex);
  drawQuad(250, 500, 500, 500, 500, 750, 250, 750, mTex);
  drawQuad(250, 500, 500, 500, 500, 750, 250, 750, yTex);
  drawQuad(250, 500, 500, 500, 500, 750, 250, 750, kTex);
  drawQuad(500, 500, 750, 500, 750, 750, 500, 750, yTex);
  drawQuad(500, 500, 750, 500, 750, 750, 500, 750, kTex);
  drawQuad(500, 500, 750, 500, 750, 750, 500, 750, cTex);
  drawQuad(750, 500, 1000, 500, 1000, 750, 750, 750, kTex);
  drawQuad(750, 500, 1000, 500, 1000, 750, 750, 750, cTex);
  drawQuad(750, 500, 1000, 500, 1000, 750, 750, 750, mTex);
  // row 4
  drawQuad(0, 750, 1000, 750, 1000, 1000, 0, 1000, cTex);
  drawQuad(0, 750, 1000, 750, 1000, 1000, 0, 1000, mTex);
  drawQuad(0, 750, 1000, 750, 1000, 1000, 0, 1000, yTex);
  drawQuad(0, 750, 1000, 750, 1000, 1000, 0, 1000, kTex);
}
 
void drawLines(PGraphics pg, float angle, int num, color strokeColor) {
  pg.beginDraw();
  pg.stroke(strokeColor);
  pg.smooth();
  pg.background(0, 0);
  pg.translate(pg.width/2, pg.height/2);
  pg.rotate(radians(angle));
  float w = pg.width*1.5/num;
  for (int i=0; i<num; i++) {
    float x = (i-num/2)*w;
    pg.line(x, -pg.height, x, pg.height);
  }
  pg.endDraw();
}
 
void drawQuad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, PGraphics tex) {
  noStroke();
  beginShape();
  texture(tex);
  vertex(x1, y1, x1, y1);
  vertex(x2, y2, x2, y2);
  vertex(x3, y3, x3, y3);
  vertex(x4, y4, x4, y4);
  endShape(CLOSE);
}

colin

int ONE = 1, TWO = 2, THREE = 4, FOUR = 8;

int[][] data = {
  {ONE, TWO, THREE, FOUR},
  {ONE|TWO, ONE|THREE, ONE|FOUR, TWO|THREE, TWO|FOUR, THREE|FOUR},
  {ONE|TWO|THREE, ONE|TWO|FOUR, TWO|THREE|FOUR, FOUR|ONE|THREE},
  {ONE|TWO|THREE|FOUR}
};

color bgColor = #ffffff;
color[] colors = {#00ffff, #ff00ff, #ffff00, #000000};
int pointsPerLine = 1000;
float alphaPerPoint = 150;
float thickness = 0.000166666666667;
float density = 1 / 192.0;

void setup() {
  size(700, 700);
  pixelDensity(displayDensity());
  noLoop();
  noCursor();
}

void draw() {
  background(bgColor);

  int numRows = data.length;
  
  // For each row...
  for (int r = 0; r < numRows; r++) {
    float y = height * ((float) r / numRows);
    float h = height * (1.0 / numRows);
    
    int numCols = data[r].length;
    
    // For each column...
    for (int c = 0; c < numCols; c++) {
      float x = width * ((float) c / numCols);
      float w = width * (1.0 / numCols);

      int datum = data[r][c];
      
      pushMatrix();
      translate(x, y);
      
      // Extract and draw patterns.
      if ((datum & ONE) == ONE)     draw1(w, h);
      if ((datum & TWO) == TWO)     draw2(w, h);
      if ((datum & THREE) == THREE) draw3(w, h);
      if ((datum & FOUR) == FOUR)   draw4(w, h);
      
      popMatrix();
    }
  }
}

void draw1(float w, float h) {
  float sp = width * density;
  
  for (float x = 0; x <= w; x += sp) {
    sketchLine(x, 0, x, h, colors[0]);
  }
}

void draw2(float w, float h) {
  float sp = height * density;
  
  for (float y = 0; y <= h; y += sp) {
    sketchLine(0, y, w, y, colors[1]);
  }
}

void draw3(float w, float h) {
  float xsp = width * density;
  float ysp = height * density;
  
  int lines = min(floor(w / xsp), floor(h / ysp));
  
  for (int i = 0; i < lines; i++) {
    float x1 = lerp(0, w, (float) i / lines);
    float y1 = lerp(0, h, (float) i / lines);
    
    sketchLine(0, y1, x1, 0, colors[2]);
    
    float x2 = lerp(0, w, (float) i / lines);
    float y2 = lerp(0, h, (float) i / lines);
    
    sketchLine(w, y2, x2, h, colors[2]);
  }
}

void draw4(float w, float h) {
  float xsp = width * density;
  float ysp = height * density;
  
  int lines = min(floor(w / xsp), floor(h / ysp));
  
  for (int i = 0; i < lines; i++) {
    float x1 = lerp(0, w, (float) i / lines);
    float y1 = lerp(0, h, 1 - (float) i / lines);
    
    sketchLine(x1, h, 0, y1, colors[3]);
    
    float x2 = lerp(0, w, (float) i / lines);
    float y2 = lerp(0, h, 1 - (float) i / lines);
    
    sketchLine(w, y2, x2, 0, colors[3]);
  }
}

void sketchLine(float x1, float y1, float x2, float y2, color col) {
  stroke(col, alphaPerPoint);
  _sketchLine(x1, y1, x2, y2, pointsPerLine, thickness);
}

void _sketchLine(float x1, float y1, float x2, float y2, float pts, float flux) {
  for (int i = 0; i < pts; i++) {
    float lerpAmt = random(1);
    float fluxPx = flux * width;
    float fx = flux != 0 ? random(-fluxPx / 2, fluxPx / 2) : 0;
    float fy = flux != 0 ? random(-fluxPx / 2, fluxPx / 2) : 0;
    float x = lerp(x1, x2, lerpAmt) + fx;
    float y = lerp(y1, y2, lerpAmt) + fy;
    point(x, y);
  }
}

void keyPressed() {
  if (key == 's') {
    saveFrame("output.png");
  }
}