color black=#000000; PImage img; int image_w,image_h; float av_brightness; DistImage distimage; void setup() { size(100,200,P3D); noStroke(); noFill(); ellipseMode(CENTER_RADIUS); img=loadImage("SheepHead.jpg"); image_w=200; image_h=200; av_brightness=getAverageBrightness(img); distimage=new DistImage(img); } void draw() { background(black); image(img,0,0,img.width/2.0,img.height/2.0); distimage.update(); showDistImage(00,100,0.5,mousePressed?av_brightness:255); } class DistImage { color[] c; int w,h; float[] x,y, sx; float[] freq, amp, phase; float ti; DistImage(PImage in_img) { ti=0.0; w=in_img.width; h=in_img.height; int maxpix=h*w; c=new color[maxpix]; x=new float[maxpix]; y=new float[maxpix]; sx=new float[maxpix]; amp=new float[maxpix]; phase=new float[maxpix]; for (int iy=0;iy