import java.util.ArrayList; class Point { public Point(float x, float y) { this.x = x; this.y = y; } public float x; public float y; } ArrayList points = new ArrayList(); ArrayList ordered_list = new ArrayList(); PImage face; int Fs = 10; void setup() { face = loadImage("face2.jpg"); size(face.width, face.height); noLoop(); smooth(); background(240); points.clear(); face = loadImage("face2.jpg"); face.filter(BLUR, 1.0);//map(mouseX, 0, width, 0.1, 10)); face.filter(INVERT); Fs = 6;//int(floor(map(mouseY, 0, height, 5))); float mi = 255; float ma = 0; for(int i=0; i< face.width*face.height; i++) { if(red(face.pixels[i]) > ma) ma = red(face.pixels[i]); if(red(face.pixels[i]) < mi) mi = red(face.pixels[i]); } noFill(); for(int xi = 0; xi < face.width / Fs; xi++) { for(int yi = 0; yi < face.height / Fs; yi++) { float val = red(face.pixels[xi*Fs*face.width + yi*Fs]); float yy = yi*Fs + random(-1,1); float xx = xi*Fs + random(-1,1); float overlap = map(mouseY, 0, height, 1.0, 10); scribbleSquare(yy - Fs*overlap/2, xx-Fs*overlap/2, yy+Fs*3, xx+Fs*3, map(val, mi, ma, 0, 1)); } } stroke(20,50); strokeWeight(.5); beginShape(); Point p = (Point)points.remove(0); while(!points.isEmpty()) { Point pn = (Point)points.get(0); float mindist = dist(p.x, p.y, pn.x, pn.y); int minidx = 0; for(int i=1; i