float [] px = new float[0]; // hold the mouse pressed marks float [] py = new float[0]; float [] distance = new float[0]; //holds the pixel’s distance to the marked point int [] idx = new int[0]; //used for sorting the pixels PImage MyImage; void setup(){ size (400,400); MyImage = createImage (width, height, RGB); //create an image image(MyImage,0,0); } void draw(){ stroke(0); for(int i=0; idistance[j]){ float t = distance[i]; //swap in ascending order distance[i] = distance[j]; distance[j] = t; int tr = idx[i]; idx[i]=idx[j]; idx[j] = tr; } for(int i=0; i