Particle3D[] tracers; Attractor attractor; Repulsor[] repulsors; Vec3D light; float MAX_STEER=.1f; float MAX_VEL=1.0f; int NUM_REPULSORS = 100; int NUM_TRACERS = 100; void setup(){ size(800,800); background(120); noStroke(); randomTracers(); Vec3D target = new Vec3D(0,0,0); attractor = new Attractor(target,20f,1f); randomRepulsors(); light = randomLight(); smooth(); } void draw(){ translate(400,400); rotate(HALF_PI); /*for(int i=0;i MAX_STEER) steer = steer.mul(MAX_STEER / steer.size); tracers[t].update(steer); stroke((int)random(120.0f),(int)random(40.0f),(int)random(40.0f),20); float s = random(40.0f); if (tracers[t].vel.size>.5f) line(tracers[t].pos.x+s*tracers[t].vel.y+random(-4f,4f),tracers[t].pos.y-s*tracers[t].vel.x+random(-4f,4f),tracers[t].pos.x-s*tracers[t].vel.y+random(-4f,4f),tracers[t].pos.y+s*tracers[t].vel.x+random(-4f,4f)); noStroke(); fill(255,120); //ellipse(tracers[t].pos.x+light.x,tracers[t].pos.y+light.y,4,4); ellipse(tracers[t].pos.x,tracers[t].pos.y,4,4); fill(0,120); ellipse(tracers[t].pos.x,tracers[t].pos.y,2,2); if(tracers[t].pos.x>tracers[t].age) tracers[t] = randomTracer(); if ((tracers[t].vel.size<.5f)&&(random(100f)<5f)) tracers[t] = randomTracer(); } } Particle3D randomTracer(){ Vec3D pos = new Vec3D(-420f,random(-400f,400f),0); Vec3D vel = new Vec3D(1f,0f,0f); vel = vel.mul(MAX_VEL); return new Particle3D(pos, vel); } Vec3D randomLight(){ Vec3D pos = new Vec3D(random(-1f,1f),random(-1f,1f),0); pos = pos.normalize(); return pos; } void randomRepulsors(){ repulsors = new Repulsor[NUM_REPULSORS]; for(int i=0;i