Shop OBEX P1 Docs P2 Docs Learn Events
Fun with Fractals: Snowflakes and Ferns — Parallax Forums

Fun with Fractals: Snowflakes and Ferns

HannoHanno Posts: 1,130
edited 2010-10-19 13:28 in Propeller 1
Hi,
I've had some fun exploring fractals with 12Blocks.

The "Fern" program was inspired by this:
http://www.home.aone.net.au/~byzantium/ferns/fractal.html
It continually calculates new x,y coordinates according to a simple function. The result is a beautiful fern leaf!

The "Snowflakes" program calculates "Koch Flakes" based on:
http://en.wikipedia.org/wiki/Koch_snowflake
This shape is drawn using a simple recursive algorithm. The result is a beautiful snowflake. The program animates several flakes falling as they "twinkle".

Video/photos coming soon...
Hanno
642 x 552 - 41K
537 x 370 - 24K

Comments

  • HarleyHarley Posts: 997
    edited 2010-09-12 21:30
    This title reminds me back in 1985 in Scientific American magazine on the Mandelbrot fractals. Where I worked there was a fellow who spent lots of time on a Symbolics computer. And he had a high resolution color monitor, although it was positioned about 75 feet down the hall and in another room.

    When the SA article came out this sharp dude quickly got the Mandelbrot images which 'distracted' many engineers and others; he'd even let it run overnight to get some high magnifications of areas of interest. An amazing set of fractals soon were being made public and I recall leaves and other interesting images that could be generated. Mathematics can produce interesting patterns for us humans.

    Hope this isn't too off-subject.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-13 00:12
    Back when MSDOS ruled the world and 386 computers were new the idea of expermenting with Mandelbrot fractals and fractal ferns crossed my mind as a lunch break coding exercise whilst working on a military wireless project.

    I discovered that if you were writing in assembler under MSDOS, which uses the 32 bit 386 CPU in 16 bit "real" mode" you could put a prefix byte in front of instructions that would make just that instruction operate in 32 bit mode.

    Wow, what a discovery, 32 bit arithmetic ops under MDSOS. Now we can make some faster renderings.

    Result was that said military wireless project development pretty much stopped for two weeks as the entire team got hooked on the idea and our lunch breaks got longer and longer....:)
  • HannoHanno Posts: 1,130
    edited 2010-09-15 14:36
    Heater/Harley,
    Yes, Mandelbrot brings back good memories :)
    Amazing to think what complexity lives beneath a simple formula.
    I used to wait for hours to zoom to another Mandelbrot set- now it's real time!

    See attached for photos of the fern and snowflake as rendered by the propeller running the 12block programs above...
    Hanno
    640 x 610 - 133K
    640 x 472 - 128K
  • LeonLeon Posts: 7,620
    edited 2010-09-15 14:46
    Mandelbrot was one of the standard demos for transputer arrays 24 years ago. The algorithm suited the transputer very well.
  • HannoHanno Posts: 1,130
    edited 2010-09-15 15:17
    Has someone done Mandelbrot for the Propeller? Nice demonstration of how you can run same algorithm in multiple cogs to speed up the application...
    Hanno
  • Heater.Heater. Posts: 21,230
    edited 2010-09-15 15:24
    Hano,
    Has someone done Mandelbrot for the Propeller?
    

    As you brought up fractals and I happen to be playing with float32 for the first time on the Prop that idea did cross my mind.

    But then, wouldn't it be better to use 64bit fixed point arithmetic for maximum zoom without loss of detail?
  • HannoHanno Posts: 1,130
    edited 2010-09-15 15:38
    I haven't done the calculations- but I doubt doing serious Mandelbrot zooming on the Propeller will be much fun. I would use fixed point 32bit integer math- and not worry about zooming very deep. Float would be very slow- even if you used all 8 cogs.
    Hanno
    ps- Here's the windows version of fractint: http://www.nahee.com/spanky/pub/fractals/programs/ibmpc/windows/WinFract_20-04-p09.zip
  • Heater.Heater. Posts: 21,230
    edited 2010-09-15 16:13
    You are right, what am I thinking. I'm forgetting how long we used to wait for Mandlebrot on old PCs.

    This has to be done in such a way that it can spread over multiple Propellers. There are many three Prop TriBlades out there and Humainoid has 40 in the Ultra Spark.

    I seem to remeber that in the Transputer days they used to farm out the work line by line.
  • HannoHanno Posts: 1,130
    edited 2010-09-16 14:07
    So- after 5 years no one has done Mandelbrot???
    I suppose I'll have to give it a go. I'm thinking 32bit fixed integer math running in pasm. To keep it simple, a single cog looping through the pixels and handling the user interface with another cog displaying the video. That leaves 6 cogs or 120mips for mandelbrot. Could be easily scaled up with multiple props.
    Hanno
  • HarleyHarley Posts: 997
    edited 2010-09-16 16:25
    One problem is there won't be all the colors available to assign very nice Mandelbrot patterns. (Prop II should though, yes?) B/w won't be very interesting, IMHO.
  • HannoHanno Posts: 1,130
    edited 2010-10-19 13:28
    I posted some quick code to calculate Mandelbrot fractals with the Prop here:
    http://forums.parallax.com/showthread.php?t=126429

    Potatoehead has already gotten it to work with his hi-color display!
    Humanoido is looking at getting it to work with his 40-Prop "super"computer.
Sign In or Register to comment.