I am trying to modify this DLA script to respond to an image loaded in the background.
I can't get it to work for some reason. It seems to be responding to parts of the image and not others.
What should be happening is the points should become more dense in the areas where the red value is 58 and less dense where it is 256. This is modulated with the sticking probability parameter.
This is the image I am using.
Can someone help? This is the code am using.
//list of current circles
ArrayList circles;
//radius of the circle
public float diameter = 4;
float diameter_sq = sq(diameter);
//where to add new circles
int w = 1000;
int h = 500;
float rr = 0;
float gg = 255;
float bb = 0;
float max_distance = w;
//maximum move in x or y direction at each step
float max_move = 1;
//tie this variable into an image value
public float sticking_probability = 1;
float max_x, max_y, min_x, min_y;
PVector dla_center;
float dla_radius;
float bounds_addition = 50;
float bounds_scalar = 1.5;
//use bucking for quick interestion
HashMap buckets = new HashMap();
// FORREST ADDED TWO FUNCTIONS, fillArea and addCell
// fill an area with random green
void fillArea() {
fill(rr,gg,bb);
}
//int[][] cp = new int[w][h];
public float[] allc = new float[h+w*w];
// addCell takes the x,y position and plots a random sized dot.
void addCell(float xPosition, float yPosition) {
// for right now, we use center mode. It may be better to use corner mode.