/* ---------------------------------------------- Computing Kaizen Studio Advanced Studio VI Spring 2010 Columbia University GSAPP Negotiating Bodies Code by Edwin Liu http://www.arch.columbia.edu/ http://proxyarch.com/kaizen This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License -----------------------------------------------*/ Block[] blockArrays; Block[] siteBlockArrays; int numBlocks = 0; int maxNoBlocks = 500; PVector [] blockPoints; PVector myPoint; ArrayList ptsList = new ArrayList(); //////////////////CONTROL PANEL/////////////////////// // BLOCK SIZE INITIAL (cubed) int initBlockSize = 4; // BLOCK ATTRACTION RADIUS int attractRad = 250; // BLOCK GRAVITY TOGGLE boolean gravity = true; boolean trajectoryCrv = false; boolean blockAttractDisplay = true; boolean blockDisplay = true; float threshold = 500/6.5; int emitterFreq = 3; // PARTICLE NOISE SCALAR VALUE float noiseScX = 1800; float noiseScY = 3000; float noiseScZ = 2000; // PARTICLE NOISE RANGE (Determines seeding origin) float noiseRangeX = 300; float noiseRangeY = -300; float noiseRangeZ = -100; // PARTICLE EMITTER DURATION (frames) int pLength = 200; /////////////////////////////////////////////////////////// color clr = color(255,255,255); color clr1 = color(0,255,0); float camlen = 1000; void setup(){ size(600, 450, P3D); blockArrays = new Block[numBlocks]; siteBlockArrays = new Block[numBlocks]; } void draw(){ background(200); pushMatrix(); translate(300,225,-25); scale(1.15,1.15,1.15); grid(); popMatrix(); lights(); directionalLight(50,50,50, 0,-1,0); translate(0,0,-30); float touchThresh = 50; PVector myBlobCenter = new PVector(mouseX, mouseY); //every framecount create #(emitterFreq) of new blocks at touch point if (mouseX != 0 || mouseY != 0){ for(int j=0; j maxNoBlocks) for (int j = 0; j < blockArrays.length; j++) { int offset = blockArrays.length - maxNoBlocks; blockArrays = (Block[]) subset(blockArrays, offset); } //display and behavior for (int j = 0; j < blockArrays.length; j++) { blockArrays[j].display(); blockArrays[j].grow(); blockArrays[j].seperate(); if(frameCount%2 == j%2){ blockArrays[j].grouper(); } } camera(); fill(255,200); noStroke(); ellipse(myBlobCenter.x, myBlobCenter.y, 50,50); } void grid(){ // GRID stroke(160); for(int i=-200; i<=200; i+=25){ for(int j=-200; j<=200; j+=25){ line(-200, j, 200, j); line(i, -200, i, 200); } } stroke(120); for(int i=-200; i<=200; i+=50){ for(int j=-200; j<=200; j+=50){ line(-200, j, 200, j); line(i, -200, i, 200); } } stroke(80); strokeWeight(2); noFill(); rect(-200,-200,400,400); line(-200,0,200,0); line(0,-200,0,200); strokeWeight(1); }