Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - [matrixutils]+[d3dfunc] Fractal vector/velocity field! awesomeness.

Neuro Fuzzy
Years of Service
User Offline
Joined: 11th Jun 2007
Posted: 22nd Jan 2011 22:12 Edited at: 22nd Jan 2011 22:31

The grid you see is a direction vector grid. The color is determined by the sine of the log of its magnitude (basically, color is logarithmic, but cyclical). The white line is of a particle following this velocity field (NOT taking magnitude into account, speed is always 1).

Other animations (links, because they're animated gifs, and are like 1mb each)

Basically, blah blah blah fractal. The method is explained in the first paragraph of this page:

You need matrix utils for the log() function, maybe others, and d3dfunc for the line drawing.

+ Code Snippet

Hold the space bar to check out a different part of the julia set.

If you want to start messing with the values, lemme tell ya how:
size changes the size of the whole box. Margin adjusts the margin around the edges. gridres is the grid resolution (how many arrows there are on the screen). ArrowLength adjusts the length of the arrows on the vectors (usually +5 to -5 from the value that's there is more than enough). The array vf holds the vector/direction information on the grid (this is what is displayed directly by the arrows). The array vfMag holds the magnitude of each vector in the corresponding vf element. calc_juliavelfield (calculate julia set velocity field) fills vf and vfMag, given a complex number (the first two values) to define the julia set, an offset value (added to the first complex value), the first iteration number, and the second iteration number. (where Z_n is the vector of the nth iteration of the julia set, a is the first iteration number, and b is the second iteration number, the function returns Z_b-Z_a)

You can also replace calc_juliavelfield with calc_brotvelfield. This is where those "modx/mody" values come in handy. They kind of offset the set. Anyways, just swap the functions out and put some changing variable in them for awesome stuffz.

Login to post a reply

Server time is: 2017-03-23 23:53:37
Your offset time is: 2017-03-23 23:53:37