Friday, March 02, 2007

What fun!

I finished the koch snowflake (question 3 of Assignment 1) today.

I was really pleased with my algorithm, as it is very simple and has no special cases.
I did not use trigonometry, so I did not need to worry about quadrants etc.

Very beautiful structure; both the output and the code.

I then played around, and tried out variations.

Here are three different experiments for your amusement.

The first one was done by simply inverting the direction of triangle. Instead of opening outwards, it opens inwards. I provide the case for n=0,n=1,n=2 and n=4.

The second example was done by instead of creating perfectly equilateral triangles, each time it creates a slightly longer isosceles triangle. I provide the case for n=0,n=1,n=2 and n=8 (the most pretty - it looks like a buddhist mandala!)

Finally in the third I used the Koch snowflake but I interlaced two large green ones and then put two smaller ones inside.

Beautiful images, hey! What a fun course!





No comments:

...

.. It's in words that the magic is -- Abracadabra, Open Sesame, and the rest -- but the magic words in one story aren't magical in the next. The real magic is to understand which words work, and when, and for what; the trick is to learn the trick. ... And those words are made from the letters of our alphabet: a couple-dozen squiggles we can draw with the pen. This is the key! And the treasure, too, if we can only get our hands on it! It's as if - as if the key to the treasure is the treasure! ------- John Barth, Chimera