ianhi_processing/genArt-PracticalGuide/chap5/twoDimPerlinNoiseViz/twoDimPerlinNoiseViz.pde
//Visualization of 2D Perlin noise
//change the drawPoint method to drawPoint[2/3] to change the vizsulation method.

//This is based on code "Generative Art; A practical guide using processing" by matt pearson
//http://zenbullets.com/book.php

//Author Ian Hunt-Isaak
//ianhi.github.io
//ianhuntisaak [atNOSPAM] gmail.com

void setup(){
  size(800,300);
  smooth();
  background(255);
  float xstart = random(10);
  float xnoise = xstart;
  float ynoise = random(10);
  
  for (int y=0;y<height;y+=5){
    ynoise+=.1;
    xnoise=xstart;
    for (int x =0;x<=width;x+=5){
      xnoise+=.1;
      drawPoint(x,y,noise(xnoise,ynoise));
    }
  }
}

void drawPoint(float x,float y,float noiseFactor){
  float len = 10*noiseFactor;
  rect(x,y,len,len);
}
void drawPoint2(float x, float y, float noiseFactor) {
  pushMatrix();
  translate(x,y);
  rotate(noiseFactor * radians(360));
  stroke(0, 150);
  line(0,0,20,0);
  popMatrix();
}
void drawPoint3(float x, float y, float noiseFactor) {
  pushMatrix();
  translate(x,y);
  rotate(noiseFactor * radians(540));
  float edgeSize = noiseFactor * 35;
  float grey = 150 + (noiseFactor * 120);
  float alph = 150 + (noiseFactor * 120);
  noStroke();
  fill(grey, alph);
  ellipse(0,0, edgeSize, edgeSize/2);
  popMatrix();
}