/** Cat Disintegrator
Dave Bollinger, Feb 2006
http://www.davebollinger.com
For Processing 0109 Beta

click to explode the cat
multiple clicks will increase complexity
(further exploding an already exploding cat)
then once it's going real good, watch it as it settles
Moire patterns for free
*/ float ctrx, ctry; // screen center PImage tex; // texture image Particle [] parties; int nparties; void setup() { size(300, 300, P3D); ctrx = width / 2f; ctry = height / 2f; tex = loadImage("fasa100.jpg"); nparties = tex.width * tex.height; parties = new Particle[nparties]; int idx = 0; for (int y=0; y<100; y++) { for (int x=0; x<100; x++) { parties[idx] = new Particle(x-50, y-50, tex.pixels[idx]); idx++; } } } void mousePressed() { float mx = mouseX - ctrx; float my = mouseY - ctry; float mz = 0f; for (int i=0; i 0f) { float acc = 10f / dis; p.impulse(dx*acc, dy*acc, dz*acc); } } } void draw() { background(0); translate(ctrx, ctry, 0); for (int i=0; i