Saturday, August 19, 2006

Brownian Motion in Three Dimensions

I saw a Blog a while back talking about Brownian Motion in 3D, so I decided to try it out for myself.
I extended 1D Brownian motion to 3D by applying the equation to each of the X,Y and Z components. I then implemented a radial version (not really Brownian Motion anymore), where the particle direction vector can rotate by a fixed amount each iteration.

The C++/OpenGL code simply using STL lists to keep track of the particles position, and plots its path with a varying HSB colour based on the iteration index.

Below are some screenshots. I added trackball rotation and zoom, so it can be oriented and zoomed in 3D. Pretty cool...