Monday, February 27, 2006

Divide & Conquer

A good friend of mine sent me (sometime back in '05) a link to the complexification gallery of computation. The site is loaded with plenty of amazing, mathematically complex computer-generated art. Being a hobbiest musician and a computer science guy that likes math, I was really impressed and inspired at the same time. As it turns out, some of the art there was done using Processing, and some other using Macromedia's flash technology. I decided to give Processing a try, just because it would be easier for me since I already knew my way around Java.

Jared Tarbell has published most (if not all) of his Processing source code generating his art published in the complexification website, so I decided to take a look at it and start playing around.

After looking at Jared's code, I went on to the Processing manual and examples and understood a bit more of what was going on. That led to some extra inspiration since I could see how the Processing source code was suddenly combining math and art. Somewhere in between all that, I remember having more or less the following thinking:

"... hmm ... I know I can't paint any art in real life ... (even the technical drawings I had to go through during my Engineering studies were very hard for me!) ... so this is cool, I can do the computer paint for me ... " and then "... OK, so how am I gonna fill in the frame?". That's where recursion and divide & conquer came to my mind.

Divide and Conquer is a computer science algorithm design and problem solving technique derived from other fields (war and military strategy, politics, economics, etc). The general idea behind it is that given a complex or large problem, one could try to break it into several n smaller or simpler (but similar in nature) problems. This same technique can be then applied again to this new smaller problems, and so and so on (this is called recursion)... until the problems are simple or small enough so that we know how to solve them. Once we solve the little problems, the sometimes hard part starts where we need to (step by step) re-combine their solutions to come up with the solution to our initial problem.

Well... I just did that with the painting. I didn't have any idea what to paint, so I decided to break the problem into painting smaller boxes. Then I applied recursion, until the boxes were small enough so that I actually had an idea of what I wanted to do with them. And then I recombined them. So this brought up a small Processing program that leads to graphics such as:



Austin has a great lake, very nice golf courses and good food. I like all three things :-). So I've taken a picture showing red apples, another one from a nice golf course and one from a sky and lake sight. They are not necessarily from Austin, but they are equally inspiring. Going forward and combining some randomness with these colors, I came up with plenty of different frames.

Once I had all those small boxes (actually, 24 of them, 8 per color), I wanted to jump back one more step from recursion and make up a bigger frame out of them.

This led to the next math-related inspiration: the four-color theorem. This problem has a fascinating history behind. Anyway, I only had 3 colors. I have (manually) arranged the boxes "a gusto y piacere", but taking care that one given box never touches another box of the same color. I've also grouped them in 3 rows, 8 boxes per row, and where each color has at least 2 boxes per row. This has few solutions, but I've chosen:

red -apples- : (3, 3, 2)
blue -lake- : (3, 2, 3)
green -golf- : (2, 3, 3)

[wait... that looks like a matrix :-). Oh well... that might be the starting point for my next try...]

Then I've added some transparency. And voila, here is my first computer-generated graphics "art", which I call, of course, "Divide and Conquer" oh ... wait ... shall I call it my first "test"? :-)

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home