QueTwo's Blog

thouoghts on telecommunications, programming, education and technology

Mandel Brots In Flex

,,,,,,,

Sample #3 is a bit more complex than the last two, but just as fun.  This application is a renderer of the Julia Mandel Brot set.  You know those patterns that you can keep zooming in, and zooming in to get really neat repeating, yet seemingly random patterns? Yeah, this lets you play with them. Again, the view source is available by right clicking on the app, and going to View Source.

The app itself, has a few controls on the bottom of the screen.  The most important one is the "Generate" button which will generate a set at the (-2,1) , (-1,1) set.  From there you can draw a box on the screen to zoom in, or Control-Click to zoom out.  You can control the colors by the three horizontal slider controls at the bottom.  They are in the order of Red, Green, Blue, and will cause the value to increase by the number that you selected for each iteration (making the color more intense as it gets to infinity).  Black in this application designates an infinite number.   Finally, to the right there is a stepper that will allow you to set the number of iterations that each pixel is tested for to see if it gets closer to infinity. Each additional test will make the render slower, but it will make the drawing more accurate and crisp.

This application is to showcase some internal event handling, such as the mousing control, and how to use the ENTER_FRAME event to split up complex functions so that Flash can take care of housekeeping items while your function runs (like updating graphics, or changing the mouse cursor).  Another thing that is showcased in this app is the ability for a user to split up their components and make them extensible — for example in this app, you can download the source and input in your own formula (via the getCycles(…) function) to get other patterns.  Wikipedia is a great source for additional mathematical patterns you can generate.

The hardest thing about this app that layed me up for a few days was the zoom-in function.  For some odd reason I was having a real hard time with the different planes having different numbering schemes (pixels -> r).  Once it clicked, it was much easier than it should have been 🙂

Have a suggestion for the next sample??  I need some ideas.  I like working on these samples every so often, as it lets me play with the side of Flex and Flash that I never play with in my day job.  I’m starting to tire of the math examples, but if you have a compelling one, I’m up for it 🙂

Advertisements

One response to “Mandel Brots In Flex

  1. julien October 24, 2008 at 5:06 am

    REally cool, well done

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: