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 / Is this a fractal?

Author
Message
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 4th Apr 2006 14:36
Yes, I know, no questions, but it's still a code snippet eh?



Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Apr 2006 14:53
This is a fractal



it's practically a certain pattern you can do over endlessly.

But, I have to say it looks good

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 4th Apr 2006 14:54
Ah, now I see - I've seen some pretty descent ones here, no idea how to make 'em though...

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Apr 2006 14:58
Now this is a fractal



These ones use a complex formula with the 2D coordinates of each point your rendering to produce the colour - it's like infinately zoomable, and the more you zoom, the more detail you find add infinitum.

Mandelbrot fractals are the most common, you should look for an example of those as the code is quite straightforward really.


Van-B

Put away, those fiery biscuits!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Apr 2006 15:00
lol, that's a nice one VanB!
But I think this one is a bit hard to find the iteration in.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 4th Apr 2006 15:36
I think you can notice the iteration when you look at the big amber bits, if you look at that huge one, and then there's a smaller one next to it, that's repeated to the right side of the image, and I'm assuming it repeats more past the image... very nice looking

Evil Booger
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: My evil lair
Posted: 5th Apr 2006 00:54
It's kinda...scary.

boogers will take over the world
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Apr 2006 13:02 Edited at: 8th Apr 2006 16:57
heard some time back that there was some code for working out the bits in a photo that were unclear when you zoom in for a close up.

just thought I'd mention it.

[Edit]

found this site which has DBPro code and other stuff.
http://www.underwaredesign.com/forums/index.php?showforum=8
http://www.dbhut.com/fractal.html
[edit/]

I'm not getting you down am I, Ho Look! another fancy Door?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 7th Apr 2006 15:41
That sounds a bit complex, but if it worked then that would be cool - Say you had an eye missing in the picture though, it would probably just cover it up with skin.

Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 8th Apr 2006 11:00
Zotoaster, here's a tutorial I wrote (in French, I'm sorry) which explains how to draw fractals like Van B's.
http://www.seuret.com/darkbasic/index.php?rub=fractales
If you don't understand French, try to use the translator of google or just copy/past the code and try to understand it

Hmm.. The tutorial explains only how to make them in black and white... If you want color, you've to :
- load a bitmap like the ones you see there :
http://www.mircscripts.org/downloads/screenshots/degrade%5B05-01%5D.png
Its dimensions should be x*255 or 255*x
- instead of making a grey color with rgb(g,g,g), get the color at the coordinates x,g (or g,x) from the bitmap
- draw the dot with the color you got before.

Reading bitmap is slow, you should also read all the colors at the beggining of your program, stock them in an array and then read the array instead of the bitmap.

The sleeper must awaken !

Login to post a reply

Server time is: 2024-11-23 07:32:34
Your offset time is: 2024-11-23 07:32:34