class particleSystem { int numOfParticles; int numOfSprings; Particle particles []; Particle ptemp []; Spring s []; Derivative deriv []; float gravitational = 0.0f; float drag = 0.1f; int ptCount; particleSystem(int numOfParticles_, int numOfSprings_ ) { numOfParticles = numOfParticles_; numOfSprings = numOfSprings_; particles = new Particle[numOfParticles]; ptemp = new Particle[numOfParticles]; deriv = new Derivative[numOfParticles]; s = new Spring[numOfSprings]; for (int i = 0; i < numOfParticles; i++) { particles[i] = new Particle(); particles[i].mass = 10; particles[i].fixed = false; Vector3D pos = new Vector3D((float)Math.random()*400.0f,(float)Math.random()*400,(float)Math.random()*0); Vector3D vel = new Vector3D(1,0,0); particles[i].setPropertiesAndTurnOn(pos,vel); ptemp[i] = new Particle(); deriv[i] = new Derivative(); } for (int i = 0; i < numOfSprings; i++) { s[i] = new Spring(); s[i].k = 0.1; s[i].damp = 0.01; s[i].restLength = 400; } s[0].from = 0; s[0].to = 1; s[1].from = 0; s[1].to = 2; s[2].from = 0; s[2].to = 3; s[3].from = 4; s[3].to = 1; s[4].from = 4; s[4].to = 2; s[5].from = 4; s[5].to = 3; s[6].from = 1; s[6].to = 2; s[7].from = 2; s[7].to = 3; s[8].from = 3; s[8].to = 1; } void idle(float dt) { updateParticles(particles, numOfParticles, s, numOfSprings, dt, 1); for (int i=0; i