### How to Design a Pythagorean Tree

A Pythagorean tree fractal is constructed from three squares. It is named after Pythagoras because the three squares enclose a right triangle and thus the sides of the squares satisfy the Pythagorean Theorem. The construction begins with the black square in the figure to the right. Attach a right triangle to the "top" side of the square along the right triangle's hypotenuse. Attach two squares (the red and blue ones in the figure) along the other two sides of the triangle. The angle θ between the red square and the black square is set in advance. The same procedure is then applied to each of the smaller squares with the right triangle always attached in the same orientation.

1. Select Design\Examples\Pythagorean Trees
2. Select an angle θ between 0 and 90 degrees. This will be the angle that the red square will make with the black square. You can either type the number in the text box or use the slider underneath the figure to select an angle.
3. Click on "Create IFS" when done. If the preview window is open you can see a rough approximation of the tips of the tree.
4. For best results the program will automatically select the deterministic method and the unit square for the initial design polygon and for the initial set in the fractal window. Another good choice for the initial set with the unit square polygon is to select "design polygon filled..." under the "Draw\Add Picture (Initial Set)" menu. Either of these choices for the initial set will allow the program to quickly draw each iteration in the deterministic method using recursion.
5. With the choices in item (4), there are three coloring schemes possible. "Use IFS Color Scheme" will use the colors of the first two functions in the IFS window for the left and right squares, respectively. "Use Image Colors" will color the entire tree with the color used for the initial set (outlined or filled). Select "Overlay Images" to color the new squares for each iteration in their own color based on the order of the colors in the IFS Palette (see Code\IFS Color Scheme\Edit IFS Palette). Note that gradient coloring and color stealing will not be used here even if checked in the Code\IFS Color Scheme menu. See examples below. Warning: Attempting to draw too many iterations using recursion may crash the program and/or freeze your computer. The program therefore has an upper limit on how many iterations it will attempt using recursion. Once you reach that limit, additional iterations will be drawn using the standard deterministic method. The deterministic method may use a different coloring scheme, so you may notice a change in how the iterations are colored. There is no way to stop the drawing in the middle of a recursive drawing except by using ctrl-alt-del to kill the application, so be careful using recursion! You can force the program to not use recursion and still have a unit vertical line as the initial set by selecting a rectangle as your initial set (under the "Add Picture (Initial Set)" submenu) and setting the width = 0 and the height = 1.
6. If the design polygon is not the unit square, or the initial set is not the design polygon, then the iterations for the deterministic method will revert to the standard deterministic drawing method and color schemes.
7. If you open an IFS file and choose the deterministic method with an appropriate design polygon and initial set, the program will try to detect if the IFS represents a Pythagorean tree to see if it should use recursion to draw the iterations. If you want to use recursion, be sure to change the design polygon to the unit square and the initial set to "Design Polygon" either outlined or filled. The use of other design polygons or initial sets will result in the program using the regular (slower) drawing algorithm for the deterministic method.
8. You can copy the image in the picture box to the clipboard with the standard Copy menu command (or type ctrl-C), or you can click in the picture box with the right mouse button to get a contextual menu with options to copy the image or save it to a file in gif, png, jpeg, or bitmap format.
 45 degrees, Use IFS Color Scheme 60 degrees, Use Image Colors 39 degrees, Overlay Colors