int side=50; int sx=side+1; int sy=side+1; int sz=side+1; int hsx=int(sx/2.0f); int hsy=int(sy/2.0f); int hsz=int(sz/2.0f); int nc=150; float[][][] points=new float[sx][sy][sz]; float[][] transDown=new float[sx][sz]; float[][] transUp=new float[sx][sz]; float[][] transLeft=new float[sy][sz]; float[][] transRight=new float[sy][sz]; float[][] transFront=new float[sx][sy]; float[][] transBack=new float[sx][sy]; int[][][] volumes=new int[nc][2][3]; float ct=0.5; float ay=0.50; float ry=0.005; float ax=0.2; float factor=1.0; float scx=150.0/sx; float scy=150.0/sy; float scz=150.0/sz; void setup(){ size(800,290); background(255); noFill(); framerate(18); setupVolume(); } void draw(){ factor=1.0; calculate(); drawProj(); filter(BLUR,5); drawProj(); noLoop(); } void keyReleased(){ background(255); setupVolume(); loop(); } void mouseReleased(){ background(255); setupVolume(); loop(); } void setupVolume(){ volumes[0][0][0]=1; volumes[0][1][0]= side; volumes[0][0][1]=side-1; volumes[0][1][1]= side; volumes[0][0][2]=1; volumes[0][1][2]= side; volumes[1][0][0]=1; volumes[1][1][0]= side; volumes[1][0][1]=1; volumes[1][1][1]= 2; volumes[1][0][2]=1; volumes[1][1][2]= side; for(int c=2; c0) transDown[i][k]+=points[i][j][k] ; if (points[i][j][k]<0) transUp[i][k]-=points[i][j][k] ; if (points[i][j][k]>0) transLeft[j][k]+=points[i][j][k] ; if (points[i][j][k]<0) transRight[j][k]-=points[i][j][k] ; if (points[i][j][k]>0) transFront[i][j]+=points[i][j][k] ; if (points[i][j][k]<0) transBack[i][j]-=points[i][j][k] ; } } } } void drawProj(){//draw projections on bottom or top platform noStroke(); fill(230,60); int dx,dy; float sc=4.4; dx=35+110; dy=145; pushMatrix(); translate(dx,dy); pushMatrix(); rotate(random(PI)); beginShape(QUADS); for(int k=1;klimit2))||((value<=limit2)&&(value>limit1))); } float ruleOfThree(float x1, float x2, float x3, float y1, float y2){// if x1 maps to y1, and x2 maps to y2, find y3 linearly corresponding to x3 return(y1 + (y2-y1)/(x2-x1)*(x3-x1)); }