tags:

views:

51

answers:

2

How can you make a Koch Snowflake Fractal using php gd so that it comes out like this...


alt text

alt text


Is it possible? Is there another resource I can use?

A: 

You can create an image and draw lines on it using imageline.

Another posibility is using SVG. Since SVG are basically XML documents, you can make an SVG image by simply echo'ing some XML.

echo '<line x1="'.$startx.'" y1="'.$starty.'" x2="300" y2="300" />';
Sjoerd
+1  A: 

imageline, imagerotate, imagefill, and imagefilledpolygon are your friends. they're all in the php manual. as far as the math goes, you can add this to your references: http://www.fractaldesign.net/algor.htm

stillstanding