I've been playing with some random graphics generation. First as a way to test some random number generators and then just for amusement....

I've only attached one graphic because they don't compress well.
Posted on 2007-11-01 00:01:05 by bitRAKE
Hello bitRAKE. Glad to see someone still fiddles with fractals old-school style  :lol:

I'd be interested to see how you accomplished using more than 3 attractors for the Sierpinski Fractal in ChaosTest2. The only code I've ever seen for them had 3,5, & 6 (the non-triangle ones usually referred to as GASKETs in the old texts). They all had pre-defined number of attractors built-into the generation algo while yours is able to change the number on-the-fly.

Sorry, can't make out what kind of fractal you render in MyBug - too small on my monitor which natively supports 1980x1650 resolution - any other res is so poor and jittery it almost gives me seizures  :shock: (monitor's fault not your proggy ;) )
Posted on 2007-11-01 03:03:08 by Shell
It's the Chaos Game:

a) calculate evenly spaced points on a circle and store in an array.
ChaosPoints:
; generate atractor coordinates around an ellipse based on screen:
; k:1 to K (or 0 to K-1, doesn't matter)
; x/2 [1+cos((2k pi)/K)], y/2 [1+sin((2k pi)/K)]
mov eax,
fld1
fadd st0,st0
fild
fdiv st0,st1
fild
fdiv st0,st2
; increment, 2pi/K
fldpi
fmulp st3,st0
fild
fdivp st3,st0
fldz ; start at zero
@@: fadd st0,st3 ; increment to next sector
fld st0
fsincos

fld1
faddp
fmul st0,st3
fistp

fld1
faddp
fmul st0,st3
fistp
dec eax
jne @B
fcompp
fcompp
retn


b) choose any random start point

c) randomly select a point from the list and move halfway from present position to point.
	xor edx,edx
div
; move midway between random attractor point and current point
add esi,
add edi,
shr esi,1
shr edi,1

d) goto (c)

A little more is done to randomly adjust the color - an error in percision actually adds color because the random distribution is pretty good. If I remove the error it's just shades of grey. The four point attractor especially benefits from this. Bet it looks awesome on the big screen.

MyBug uses the random data to draw color shifted patches. It works best on slow computers because I need to add a refresh rate option. Just didn't think about it until now. Should only take a couple minutes to fix, really. Brownian motion, random walks, etc. would be a good analogy.
Posted on 2007-11-01 14:27:19 by bitRAKE
Here are some updated versions of ChaosTest, and MyBug. I feel a need to note that MyBug isn't really meant to be run continuously - might work as a great torture device. :lol: The upper up/down control selects the number of milliseconds between screen updates.

The chaos game is usually colored based on point selection - I've included a couple variations based on that scheme. ChaosTest0 is the error-less version used to test the random number generator.
Attachments:
Posted on 2007-11-01 17:16:02 by bitRAKE
Wow bitRAKE, these programs are great, very nice color effects.

ChaosTest0 is the error-less version used to test the random number generator.

This one is somewhat wierd with 4 points, I can't recognize any square (apart of the main one) like in the other variants.

Anyway, thanks for posting all this!!
Posted on 2007-11-01 18:01:46 by LocoDelAssembly
@LocoDelAssembly:
ChaosTest0 is the error-less version used to test the random number generator.

This one is somewhat wierd with 4 points, I can't recognize any square (apart of the main one) like in the other variants.
That's because it uses the error-less version of the PRNG i.e. the colorless version ;) for a comparison in color run the version from the first post. Summary - it is the color variation that gives the perception of shape, the color(error)-less version seems like a random set of shades of grey (a-la noise) but both actually display the same polynomial graph.

@bitRAKE: Chaos Game - got it - our old friend mr. google has plenty to say about it ;) Thanks for the point-form (with examples) explanation of the meat-n-bones  :D The big screen looks blocky and stretched in DOS mode so my all old fractal proggies all look wierd  :sad: Interestingly, L-Systems fractals actually seem to benefit from this  :shock:
Posted on 2007-11-02 00:23:47 by Shell
This one is somewhat wierd with 4 points, I can't recognize any square (apart of the main one) like in the other variants.
The four point one is space filling - it lacks the structure unless some is further induced artificially. Some of the other variants cannot reach interior points, yet the four point one has perfect coverage - with random data! Not only does it reach all interior points but each has the same probablity of being reached (density, if you will).

Let me give an example of how this can be used: if we only have two random bits and our four points are: (0,0), (0,255), (255,0), (255,255). We can create a 16-bit random number generator. The start seed does not matter - only the quality of the two random bits.
Posted on 2007-11-02 06:18:46 by bitRAKE
Here is a nice effect - it almost seems like a fluid after running for a few minutes...

I've slowed the effect transitions down - looks like sunspots to me. 8)
Posted on 2007-11-17 22:52:46 by bitRAKE