void display() { if(displayMode==1) drawLattice(rawr); if(displayMode==2) { // rawr.drawLattice(); drawCells(rawr); } if(displayMode==3) drawLines(rawr); } 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 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()); } } 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()); } } } } 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) { for(int i=0;i