void display(creature c) { switch(displayMode) { case 1: drawLattice(c.phenotype); break; case 2: noFill(); stroke(80,120); ellipse(c.phenotype.averagePos,c.phenotype.mostDistant*2); drawCells(c.phenotype); break; case 3: drawLines(c.phenotype); break; case 4: drawCells(c.phenotype); blur(1); drawLattice(c.phenotype); blur(1); drawLines(c.phenotype); break; case 5: render(c); break; } } void blur(int tt) { for(int ttt = 0; ttt <= tt; ttt++){ int R,G,B,left,right,top,bottom; int c,cl,cr,ct,cb; int w1=width-1; int h1=height-1; int index=0; for(int y=0;y0) ? -width : h1*width; bottom=(y==h1) ? -h1*width : width; for(int x=0; x0) ? -1 : w1; right=(x>16 & 255) + (cr>>16 & 255) + (c>>16 & 255) + (ct>>16 & 255) + (cb>>16 & 255)) / 5; G=((cl>>8 & 255) + (cr>>8 & 255) + (c>>8 & 255) + (ct>>8 & 255) + (cb>>8 & 255)) / 5; B=((cl & 255) + (cr & 255) + (c & 255) + (ct & 255) + (cb & 255)) / 5; pixels[index++]=(R<<16)+(G<<8)+B; } } } } void ellipse(position p,float d) { ellipse(p.x,p.y,d,d); } void drawArrow(position p1,position p2) { position corner=new position(new position(0,0)); position bLeft=new position(corner.displace(140,4)); position bRight=new position(corner.displace(220,4)); float heading=radians(360-getHeading(p1,p2)); push(); line(p1.x,p1.y,p2.x,p2.y); translate(p2.x,p2.y); rotate(heading); beginShape(POLYGON); vertex(corner.x,corner.y); vertex(bLeft.x,bLeft.y); vertex(bRight.x,bRight.y); endShape(); pop(); } void displayCreatureData(creature c) { float distance=dist(c.lastP,c.p); c.distanceTravelled+=distance; fill(150); position p=c.p.displace(35,c.currentSize()*.8); textFont(uiFont,14); text("Distance Travelled: "+nf(c.distanceTravelled,4,1)+"px",p.x,p.y); text(" Average Speed: "+nf(c.distanceTravelled/float(timeSteps),2,3)+"px/frm",p.x,p.y+14); text(" Elapsed Time: "+timeSteps+"frms",p.x,p.y+28); } void drawLattice(lattice phen) { noFill(); float t=phen.tension*200; for(int i=0;i15) { stroke(255,255,255,a); line(phen.nodes[i].x(),phen.nodes[i].y(),phen.nodes[phen.nodes[i].c.output[s]].x(),phen.nodes[phen.nodes[i].c.output[s]].y()); } } //Draw Collisions for(int v=i;v120) { stroke(150+a,125,115,a); line(phen.nodes[i].x(),phen.nodes[i].y(),phen.nodes[v].x(),phen.nodes[v].y()); } } } } //Draw the cell ellipse float vel=phen.nodes[i].velocity.m; stroke(222,222,222+t); ellipse(phen.nodes[i].x(),phen.nodes[i].y(),5+constrain((vel*1.5),0,4),5+constrain((vel*1.5),0,4)); } } void drawCells(lattice phen) { noFill(); stroke(50,120); for(int i=0;i