RIP Benoit Mandelbrot- Propeller demo attached...
Hanno
Posts: 1,130
Benoit Mandelbrot died yesterday at 85. He discovered the fractal that bears his name and contributed to mathematics- especially "roughness". Here's a TED talk he gave earlier this year:
http://www.ted.com/talks/lang/eng/benoit_mandelbrot_fractals_the_art_of_roughness.html
A while ago I did some fractals with 12Blocks- here's a quick SPIN program that draws the Mandelbrot fractal to a VGA attached to a DemoBoard:
Hanno
http://www.ted.com/talks/lang/eng/benoit_mandelbrot_fractals_the_art_of_roughness.html
A while ago I did some fractals with 12Blocks- here's a quick SPIN program that draws the Mandelbrot fractal to a VGA attached to a DemoBoard:
CON 'Run on a DemoBoard with 5MHz crystal and vga pins starting at P12 _clkmode = xtal1+pll16x _xinfreq = 5_000_000 _videopin=12 OBJ _gfx:"vgagfx" 'draw graphics to VGA VAR long xs,ys,xmin,ymin,xmax,ymax long p,q,i,x,y,xn,y0,x0 pub _main _gfx.start(_videopin) 'use integral math- divide by 1000 to get actual value 'view from (-2.5,-1.5) to (1.5,1.5) xmin:=-2500 ymin:=-1500 xmax:=1500 ymax:=1500 xs:=(xmax-xmin)/200 ys:=(ymax-ymin)/200 'loop over x,y repeat y from 0 to 200 q:=ymin+y*ys repeat x from 0 to 200 p:=xmin+x*xs xn:=0 x0:=0 y0:=0 repeat i from 0 to 20 'quit loop when sqrt(xn^2+y0^2)>2 if (xn*xn+y0*y0 > 4_000_000) quit 'calculate z=(zold)^2+c in complex space xn:=(x0+y0)*(x0-y0)/1000+p y0:=(x0*y0/500)+q x0:=xn 'plot color at current x,y _gfx.color(i) _gfx.plot(x-100,y-100) _gfx.updateAttached is the resulting image. This program should really be optimized for the propeller- written in PASM and distributed among multiple cogs...
Hanno
zip
33K
Comments
Nice to see a mandelbrot fractal being rendered on a prop, even tough it's SLOOOOW.
behn-wah mahn-dehl-broh?
beh-noyt man-dehl-braht?
pin 12 ?????????? DemoBoard VGA starts at 16 .... doesn't it?
cheers ... BBR
Don't worry, the 12 is wishful thinking. The pins are still hardwired at a lower level to 16..23.
Where do we get vgagfx? My install of the Proptool does not appear to have it, and I did not find it in OBEX.
EDIT - Never mind, found it in the ZIP file
What fun we had with this, when we should have been working, back in 1985.
Thank you Benoit.
I think it is behn-wah man-dehl-braht.
Rich H
Many man hours 'down the drain' though immensely enjoyed seeing the results of a run on a high res monitor for the day. One fellow had access to a mini-computer and the high res monitor was in another part of the building. That Scientific American issue on the Mandelbrot sure did catch on fast across the country.
Hanno
This is 160x96 high color display, NTSC.
A few more adjustments to the color lookup and pixel plotter will make a nicer picture... I'll post up the toy later today. Just had to sneak this in, because I always loved fractals...
Looks like a program I used to run in DOS full screen mode.
Fractal landscapes can look scary real.
the answer for speed might be .... is ....PropBasic....?....!
http://forums.parallax.com/showthread.php?t=122103&highlight=Mandelbrot
Christof
Edit:
In this special case, speed is mainly governed by multiplications. The propeller has not got hardware multiply. So multiply has to be done in a small assembler routine, which can be very similar in SPIN or assembler.
Therefore in this special case there is no great benefit for PropBasic....
1985? What if a kid like me wants to learn about the algorithm and make my own? What's a good reference?
Well thinking about it I'm not sure I ever saw the famous Scientific American article on fractals in 1985 and was messing around with implementing them in 32 bit assembler on a Compaq DespPro 386 which was released in 1986.
Anyway why not start with the SciAm article which they kindly make available for download here:
http://www.scientificamerican.com/article.cfm?id=mandelbrot-set
You will find a lot of Mandlebrot set and fractal info and example programs on the net. Google knows where to find them.
Thanks Heater!
It's got a zoom problem, and I've spent the time I have today trying to figure it out! Render the set, which is the default, then try closer zooms, and it will break. Not sure why...
Includes nice, simple high-color TV bitmap driver. 80Mhz Demoboard, NTSC.
A full screen, single cog render works just fine. It's how I'm calculating the screen quadrants for the 4 cogs at issue. Also, if you want to use a single cog, it's possible to run it at 160x192. Change vertical size in the TV driver to 0, and double the display buffer, and the Y maximum values.
Doing that just barely fits in the 32K.
Comment out the 4 render cogs, uncomment the single display cog line you find below to render full screen in color on a single cog. Zoom is fine in that case. If you happen to see what goofy thing I got stuck on, let me know...
Screenshot shows partial multi-cog render, not resulting display.
Hanno
I'm kind of stumped as to why it doesn't always render the right picture at closer zooms though. Any hints??
If we get the PASM math, it will then be possible to do interactive fractals, kind of like FRACTINT.
One could use the keyboard to pan and zoom, with a quick, lower resolution render happening to help the user guide themselves to a point of interest, then when there is no keyboard, just refine detail...
THAT's what I'm talking about! I wonder how hard it would be to do the line by line method heater described?
http://forums.parallax.com/showpost.php?p=947156&postcount=22
I guess I'll have to get busy this weekend...
I did a few mods to it and was able to control two servos firing a UV laser at a phosphor screen using my RBBB propeller system i made 4 months ago..... I used the colour information to vary the "burn time" of the laser.
@potatohead:
Could Zoom problems be caused by the limitations of 32 bit math?
Jason