Section_Ei8ht Posted October 1, 2006 Report Share Posted October 1, 2006 So, for a computer graphics course at college, i wrote a quick program that uses C++ and opengl to display a Mandelbrot Set. A Mandelbrot Set is an infinitly complex fractal, so if you "zoom" in on the edge of the set by any factor, the edge remains complex. For more about Mandelbrot Sets, check out the wikipedia article My favorite part of the set. Its a renormalization of the set that occurs in the negative quad on the x axis (not sure what the zoom factor is): Download: MandelbrotSets.exe glut32.dll (put this in your windows system32 directory) Its pretty simple. An 800x600 window opens and displays the set. You can then use the left mouse button to zoom in on a particular point (factor of 2), the right mouse button to zoom out on a point (again a factor of 2), and the middle mouse button to reset the display to what it was on startup. The colors are defined in the code based on how many iterations the pixel is away from the set. As of now, if you want to change the color of the image, you would need to modify the source code. A note: If you zoom in far enough, you eventually get to a point where the precision of numbers in the computer is not great enough to perform the calculations, and the image gets extremely pixelated. Also because of the blue color scheme, the closer you get, the harder it gets to distinguish between what is in the set and what is borderline of the set. Changing the colors would fix this. If anyone cares enough to want to have a look at the source code, let me know, and I can send it to you (my prof asked me to not make it widely available, because he and other profs use this as an assignment quite often) Enjoy. Its worth about 2 minutes of fun. (maybe one of these days I'll add to it with zoom transitions, ability to change colors on the fly, etc.) [EDIT] Forgot about the glut32.dll. I added a link above. Quote Link to comment Share on other sites More sharing options...

e-freak Posted October 1, 2006 Report Share Posted October 1, 2006 nice stuff - what semester of math study is this? and how complex is this to render? because i think of making sprites out of this dynamically for energy explosions like in crysis thought of a photoshop plugin already? with sliders for editable values? Quote Link to comment Share on other sites More sharing options...

hessi Posted October 1, 2006 Report Share Posted October 1, 2006 nice stuff - what semester of math study is this? and how complex is this to render? because i think of making sprites out of this dynamically for energy explosions like in crysis thought of a photoshop plugin already? with sliders for editable values? i know this figure from semester 2 in my math course. fractals/complex numbers (?) are the base of all this rendering clouds stuff we use in photoshop or in a mental ray fractal shader. the fun thing is, that you cant calculate a volume for this structure. its like 2,5 dimensional. anyway: good work. maybe i will throw it over to my math professor. he always likes to show practical applications to his "boring"(it was pretty interesting due to examples like this one) math Quote Link to comment Share on other sites More sharing options...

Section_Ei8ht Posted October 1, 2006 Author Report Share Posted October 1, 2006 Thanks for the comments The math involved wasn't all that complex. The last math course I took was calc 1. The hardest part was converting pixel coordinates to cartesian coordinates. The point of the assignment was more to get us used to working with the fundamentals of OpenGL (kinda need those for an OpenGL class ) The rendering time depends on how many iterations you use to test whether or not a point is in the set; the more iterations, the more exact you are to a true mandelbrot set. I'm using 1000 iterations through the function to determine if a point is in the set, and if you zoom in to the center where all points are in the set, it becomes 1000 iterations for every pixel on the screen. I'd imagine with a few optimizations and alterations, this could be easy to render for sprites. e-freak, I like your idea about a photoshop plugin. It would give me an excuse to learn how to make them Quote Link to comment Share on other sites More sharing options...

Izuno Posted October 2, 2006 Report Share Posted October 2, 2006 back when i was in highschool in the 20th century I did my sophomore year science fair project was on the Mandelbrot set. back then our computer was old and we wrote our own Mandelbrot software in Turbo Pascal (no really, it was Turbo Pascal) that we found in an issue of Scientific American. Our resolution was 480 x 480 and we only had 8 bit color or something, with a N of 244 or 256 (n= iteration limit in Mandelbrot calculations) anyway, a full screen at very close magnification near the set boundary would take 12 to 16 hours to calculate due to the computer's lack of power. The caclulation is an iterative computation on points on the complex plain of numbers. The basic theory is that when you perform the iterative calculation on a point in the complex plain, once the iteration result magnitude goes above 2, it will spinn off to infinity. Less than 2, it is impossible to exactly predict how many iterations it will take to go above 2, if at all. The actual "set" of the mandelbrot set is the collection of Complex numbers that NEVER yield magnitudes that go above 2 when the iterative calculation is applied to them. There are many startling properties of the Mandelbrot Set, but that's for another post perhaps. Anyway, the set is considered the most compelx object in mathematics, possibly including all of nature. Quote Link to comment Share on other sites More sharing options...

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.