Tuesday, April 3, 2012

Brownian Tree

I've worked on my program to generate Lichtenberg figures and taken it a different direction. Instead of making a bunch of particles that all are attracted to each other, they are launched one at a time and attach to whatever particles have been attached before.

You start with a "seed" particle, then launch a "walker" particle, which moves randomly. The walker checks for a collision with all the attached particles (the seed being the first), and will attach itself if it gets within 1 pixel of an already-attached particle.

This naturally creates a branching pattern, simply because a walker is statistically more likely to run into one of the protruding particles, and less likely to walk all the way to near the seed.

I recently added a function that colors the particles based on when they attached themselves.

The great thing is that with a few modifications I could get this to resemble a real Lichtenberg figure more closely by counting how many particles attached in a parent-child chain through each given particle. Thus the outer-most particles would create very thin lines, and the particles linking back to the seed would create thicker lines.

I also plan to add a way to select a range of colors, so that more than just the current red-yellow-white range is available.

No comments:

Post a Comment