FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Simulation, Artificial Life
(Moderator: REAS)
   Diffusion Limited Aggregation
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Diffusion Limited Aggregation  (Read 1033 times)
Captain_Lobotomy

Email
Diffusion Limited Aggregation
« on: Sep 10th, 2003, 8:52pm »

Huh... well DLA is what I started to play around with. But it ended up like this:
 
http://users.skynet.be/frederikenhermine/
 
Caution, a fairly fast PC is probably required. If things go too slow, just run the code locally and tweak to your heart's desire.
 
FVH
 
UPDATE 12/09: slightly optimized code and added a blurred  version.
« Last Edit: Sep 12th, 2003, 9:53pm by Captain_Lobotomy »  
Captain_Lobotomy

Email
Re: Diffusion Limited Aggregation
« Reply #1 on: Sep 10th, 2003, 8:53pm »

Oh, and give it some time ...
 
Koenie

170825270170825270koeniedesign WWW Email
Re: Diffusion Limited Aggregation
« Reply #2 on: Sep 10th, 2003, 9:27pm »

I like the grid-like 'cities' that come after a while. You are using a shitload of variables though. Don't mind it though, I just like clean code with only a few variables...
 
Koenie
 

http://koeniedesign.com
Captain_Lobotomy

Email
Re: Diffusion Limited Aggregation
« Reply #3 on: Sep 10th, 2003, 9:36pm »

Yep, lots of variables. Got to store all the random factors that determine those structures just to keep them constant during the animation.
 
FVH
 
Fractal_Mike
Guest
Email
Re: Diffusion Limited Aggregation
« Reply #4 on: Sep 27th, 2003, 7:56pm »

Here's my first proce55ing program; it's very simple, so I hope you don't mind if I post the full source code here.
I tried to do it with small smooth ellipses too but the whole thing kept growing to the left upper corner (although I used the CENTER ellipse mode)..
 
Code:

//Diffusion Limited Aggregation (DLA)
//by Michael Szell 27.Sep.2003
 
void setup(){
  size(300, 300);
  background(0);
  set(150,150, #FFFFFF);
}
 
int startdiam=3;
int xpos, ypos;
 
void loop(){
  framerate(50);
  float angle = random(TWO_PI);
  xpos=int(150+sin(angle)*startdiam);
  ypos=int(150+cos(angle)*startdiam);
 
  int i=0;
  while(i<(startdiam)*200 && get(xpos,ypos)!=#FFFFFF){
    i=i+1;
    int rnum=int(random(4));
    if(rnum==0){xpos=xpos+1;}
    if(rnum==1){ypos=ypos+1;}
    if(rnum==2){xpos=xpos-1;}
    if(rnum==3){ypos=ypos-1;}
     
    if(get(xpos+1,ypos)==#FFFFFF || get(xpos,ypos+1)==#FFFFFF ||
  get(xpos-1,ypos)==#FFFFFF || get(xpos,ypos-1)==#FFFFFF){
 set(xpos,ypos, #FFFFFF);
 if(sqrt(sq(xpos-150)+sq(ypos-150)) >= startdiam-2){startdiam=startdiam+1;}
    }
  }
}

 
Fractal_Mike
Guest
Email
Re: Diffusion Limited Aggregation
« Reply #5 on: Sep 28th, 2003, 9:25pm »

And here one that I made for my freshly set up homepage http://stud3.tuwien.ac.at/~e0225885/
 
It uses more than 10% of my CPU and a friend's IE and firebird crashed ; any suggestions how to reduce this value?
 
Code:

//Diffusion Limited Aggregation (DLA)
//by Michael Szell 27.Sep.2003
 
void setup(){
  size(550, 160);
  background(255);  
  fill(#000000);
  textMode(ALIGN_LEFT);
  BFont fontA = loadFont("Meta-Bold.vlw.gz");
textFont(fontA, 50);
text("Willkommen auf der", 110, 55);
text("Homepage von Michael Szell",40,125);
}
 
int xpos,ypos;
 
void loop(){
  framerate(40);
  xpos=int(random(550));
  int yrnum=int(random(4));
  if(yrnum==0){ypos=0;}
  if(yrnum==1){ypos=160;}
  if(yrnum==2){ypos=79;}
  if(yrnum==3){
    int crnum=int(random(2));
    if(crnum==0){ypos=0;xpos=0;}
    else{ypos=0;xpos=550;}
  }
 
  int i=0;
  while(i<5000 && get(xpos,ypos)!=#99C556){
    i=i+1;
    int rnum=int(random(4));
    if(rnum==0){xpos=xpos+1;}
    if(rnum==1){ypos=ypos+1;}
    if(rnum==2){xpos=xpos-1;}
    if(rnum==3){ypos=ypos-1;}
     
    if(get(xpos+1,ypos)<#AAAAAA || get(xpos,ypos+1)<#AAAAAA ||
  get(xpos-1,ypos)<#AAAAAA || get(xpos,ypos-1)<#AAAAAA){
 set(xpos,ypos, #99C556);
    }
  }
}
 
void mouseDragged(){
 setup();
}
void mousePressed(){
 setup();
}
 
Fractal_Mike
Guest
Email
Re: Diffusion Limited Aggregation
« Reply #6 on: Nov 7th, 2003, 11:25pm »

Here's a more advanced version I completed today.
You can influence the growing direction with your current mouse position (the nearer to the border, the stronger), and the density or "sticking probability" by pressing "A" and "D".
 
http://stud3.tuwien.ac.at/~e0225885/programmieren1.html
 
Pages: 1 

« Previous topic | Next topic »