Introduction

Diffusion Limited Aggregation (DLA) is an algorithm for simulating how randomly moving, sticky particles combine. This method has been used to study lightning, metallic crystals, coral reefs, urban growth, and other problems. The resulting structures also happen to be aesthetically pleasing.

Simulations start by placing a number of seed particles in the space, and then adds a particle that moves until it sticks to a certain number of stopped particles. These moving particles are known as walkers. Walkers are added one at a time; after a walker gets stuck and becomes stationary, a new walker is added at a random location away from the structure.

What you'll need

DLATOOL outputs POV-Ray files. You'll need POV-Ray (free!) or a compatible renderer to display this program's output.

You should also be familiar with running command-line programs and editing text files.

How it works

The program is run with the command line "dlatool filename", where filename is the name of your script. I've included a few example scripts; these files end with ".dla".

Script syntax

"outfile filename" - where filename is a string. Filename is the file your output will be written to. This is the file you'll be rendering in POV-Ray.

"randomize n" - where n is an integer. It is the seed to the random number generator. If it is zero, then the seed will be taken from the system clock; otherwise your number is used.

"do n" - where n is an integer. It is how many particles you want to use. Start with modest values, as the algorithm gets slower as the structure grows larger.

"releaseoffset d" - where d is a float. As DLATOOL runs, it keeps track of how big a sphere would be that contains all the points in the structure. The releaseoffset specified how far away from this sphere to release new gliders.

"killoffset d" - where d is a float. If the glider wanders d units away from the releaseuffset away from the structure, its position is reset to the release radius. This speeds up computation by avoiding lonely gliders.

"minadja n" - where n is an integer. The glider must be next to at least n neighbors to stick.

"maxadja n" - where n is an integer. The glider must be next to fewer than n neighbors to stick.

"threshold d" - where d is a float value (such as 0.1 or 0.25). Since the probability of a glider being exactly next to another particle is small, this value lets you set a range within which the glider is close enough. I suggest 0.1 or smaller.

"velocity d" - where d is a float value. This is how fast the glider can move. I suggest values between 0.1 and 1.

"turn d" - where d is a float value. This is the maximum angle, in radians, that your glider can spin each turn. Used values between 0 (no spin) and 6.28 (total spin).

"facing b" - where b is either 0 (false) or 1 (true). When true, new gliders start out facing the ceneter of the structure, making it more likely that they'll hit something with low turn values.

"seed x y z" - where x, y, and z are float values. This places stationary particles at the beginning of the simulation. You need to have at least as many of these as your minadja is set to, or nothing will grow. Place these near the center (0 0 0), but don't put more than one in the same place.

"camera x y z" - where x, y, and z are float values. This is where you'll view the structure from in the rendering.

"focus x y z - where x, y, and z are float values. This is where your camera looks at, usually 0 0 0.

"light x y z - where x, y, and z are float values. This is where the light is.

background string - where string is a POV-Ray format color definition, with underscores ("_") where spaces would be. Check your POV-Ray manual and the example scripts for what can go here.

lightstyle string - where string is a POV-Ray format color definition, with underscores ("_") where spaces would be. Check your POV-Ray manual and the example scripts for what can go here.

rule a type radius p1 ... pn string - This is a drawing rule.
a is an integer that defines when the rule is used. If a is 1, then the rule is run when the glider is stuck to 1 other particle.
type is a character that defines what to draw; s for sphere, c for cylinder, and t for triangle.
radius is a float, used to define the thickness of spheres and cylinders ... just leave it as 0 for triangles.
p1 through pn are integers the define the order in which points are drawn. You'll provide one of these when your type is sphere, two for cylinders, and three for trianges. 0 is the glider, the newly placed particle, and the particles it stuck to are numbered starting at 1.
String is a POV-Ray format color definition, with underscores ("_") where spaces would be. Check your POV-Ray manual and the example scripts for what can go here.

Conclusion

This program is free. To the best of my knowledge this program is safe, but I cannot be held responsible for any damages caused by its use.

Send email to mike@lightcycle.org with any suggestions, comments, bugs, or questions.