// M I D G A A R D * 0 2 // by mikkel . crone . koser // http://proce55ing.beyondthree.com // or more at : www.beyondthree.com // oct. 2003 // // trying to build worms without using trail-effects // worms moving autonomousely along // the paths of vertex-curves. // // (1) tried to use the build-in sphere(int) function // but found this to be much too CPU-consuming. // // (2) used TOXI's custom code for making spheres // with varibale resolution (code can be found in // the xspehere() method below. // // (3) ended up using ellipse's instead since the // effect is very close to TOXI's spheres, and MUCH // faster. Worm midgaard[]; static int WIDTH = 360; static int HEIGHT = 360; static int DEPTH = 360; static int POP = 12; int saveNum = 0; int sphRes = 8; void setup(){ size(360, 360); ellipseMode(CENTER_RADIUS); noStroke(); fill(255, 200, 0); // populate midgaard midgaard = new Worm[POP]; for(int i=0; i0; i--){ memX[i] = memX[i-1]; memY[i] = memY[i-1]; memZ[i] = memZ[i-1]; } memX[0] = x; memY[0] = y; memZ[0] = z; } void update(){ step += speed; if(step >= 1f){ generateCoords(); step = 0f; } updateMem(); x = curvePoint(x1, x2, x3, x4, step); y = curvePoint(y1, y2, y3, y4, step); z = curvePoint(z1, z2, z3, z4, step); // draw the mutha! draw(); } void draw(){ for(int i = 0; i