# FractalTrees X

## FractalTrees X

Draws silhouettes of fractal designed trees.
Open source software for Mac OS X.

Download now
- screen shot
- email me

## Breaking News

I've just posted the first "alpha" version of FTX 2.0. download FTX 2.0a1 (349 KB). The interface is substantially new and the code has been mostly re-written. It's also a LOT faster. And the source code is included under the GPL. N.B. This is alpha software so it might not work perfectly. Enjoy -- sbw

## Introduction

It's a fractal program! It's a toy! Play with it, draw fractal tree silhouettes, and maybe even find something useful to do with it! Otherwise, please just have fun!

The images on this page were all generated with FractalTrees X. Click on them to enlarge them.

## What's new in 1.5.1?

Version 1.5.1 fixes two bugs that occurred only in Mac OS X 10.1.x (not 10.2):

- Fixed a bug that caused FTX to crash on Mac OS X 10.1.x
- Fixed a bug that rendered users of Mac OS X 10.1.x unable to change the height of the tree
- First open source software (OSS) release of FractalTrees X! The full source code is now available under either the BSD or the GNU GPL free software licenses.

### What's new in 1.5?

This release is all about making FractalTrees X more fun to play with. The program is after all a toy, so some major rendering engine changes are now available: always-on autofit, and asynchronous, interruptable drawing. Also new by request is pre-determined random values when you increase the height of the tree.

- Always-on autofit keeps the whole tree into the window, automatically
- Asynchronous drawing allows you to see the tree drawing in progress
- Interruptable drawing stops drawing if you change the settings, without waiting
- Pre-determined random values allows you to increase the height of the tree while keeping the same random tree
- Keyboard shortcuts are more intuitive
- Streamlined, simpler interface
- Nifty grab-hand cursor when you move the tree around in the window
- Added two new draw styles: "grow mode" and the default asynchronous style
- Small change to slim the tree's upper branches

## Download the current version

The latest version is FractalTrees X 1.5.1. Download it now [MacBinary/Disk Image 88K] This software is open source, and Mac OS X 10.1 is required. For everyone else, sorry, get a Mac!

### Source code

The source code is for FractalTrees X 1.5.1+. Download it now [Tar/Gzip 72.6K] This source distribution is licensed under either the BSD license or the GNU GPL. You choose. Note that the source snapshot represents slighter later code than the binary version of 1.5.1.

## What does it do?

This program draws silhouettes of fractal designed trees. It implements a recursive algorithm that generates fractal trees to the depth you specify. The math behind it is sound, but the program is supposed to be fun. So, in the interest of fun, here's a list of what kinds of play you can do with it:

- Generate deterministic fractal trees (non-random)
- Generate nondeterministic fractal trees (random)
- Watch the trees grow (do you remember KidPix? I do!)
- Play with the settings and watch the tree change, in real time!
- Play with all kinds of colour settings ... gradients, spectrums, custom background colours, etc.
- Copy or save your pictures to a file

... All of this, and more, with an ultra-advanced interface* so easy to use you won't even have to think!

* ultra-advanced interface subject to change without notice

So what are you waiting for, download it now!

## Clever tricks for trees

- Set the curliness at exactly halfway (using the Information panel)
- Use 50% transparency with the spectrum colour option
- Set the "gro" slider very high or very low
- Slowly drag the cursor slowly from "straight" to "curled"
- Use Grab app (in the Utilities folder) to capture trees with transparency (save and copy don't preserve transparency)

## Technical primer

It may be hard to believe this, but this easy-to-use program isn't just a toy, it's a fractal workshop! That's right ... every fractal tree you generate is guaranteed** to conform to the principles of fractal mathematics. But what does that mean, you ask? Well, now I'm going to tell you.

** hah, that's just a joke, I guarantee nothing

Fractals are by definition geometric objects that have a fractional dimension. That means that they are not 1D, 2D, or 3D, but rather, something like 1.5-dimensional. That means that a fractal tree is like a line, that's on it's way to becoming a surface. You can see this with the program if you turn the branch depth waaay up, the fractal starts to fill in space.

Fractals also often display self-similarity. As you zoom in or look more closely at one part of the fractal, you see a copy of the whole thing. You can see this clearly in the program, especially if you turn the randomness off. Each of the subtrees is an exact copy of the whole tree. Even with randomness on, due to the algorithm I use, each sub-tree is what we call "statistically self-similar" which means that it still has the same fractal dimension, although there are variations in the subtrees.

The algorithm to generate the trees is incredibly simple. The program draws a "Y" figure which is the base of the tree. Then, it copies that figure recursively onto each of the two subbranches, then the next four subbranches, and so on. The depth setting controls where the algorithm stops. The higher the depth you choose, the more of the tree you will see.

A true fractal tree has an infinite depth. But practically speaking, you can only draw so many lines on the screen before you have to give up. This program goes to a maximum depth of 14, where you will see 16,383 lines on the screen. A depth of 20, for example, would require 1,048,576 (2^20 - 1) lines! Each time you add a level, the time to compute and draw the tree doubles.

So you see, this program actually demonstrates a mathematical concept, even though it is fun.

In order to give each of the random trees their variation, I use the Normal Distribution, also known as the Gaussian Distribution. This is also often called the bell curve because it looks like a bell when you plot it. The normal distribution is a distribution of random variables that is interesting because it appears so often in nature. All kinds of natural phenomena follow the normal curve. In the program, you can see what happens when you apply a normal distributed random variable to the lengths and the angles of the branches. The different settings change the standard deviation of the distribution that is used.

But I still haven't got to the most interesting point about the fractal trees, the real hum-zinger. Which is that with such a simple generating function and random elements, the trees look so life-like. With this program you can generate an infinite number of trees, no two of which will be the same. It is unlikely that any two people who run this program will ever see the same tree. Somehow the simple fractal pattern approximates the complex processes that real trees undergo as they grow.

Check out the links section of this document if you're interested in finding out more about fractals.

## Links

This really isn't intended to be an exhaustive list, just my personal favorites. If you want to find out more, I suggest you go to www.google.com and type in fractal.

### Introductions

- Cynthia Lanius' Fractals Unit: Fractional Dimension is a good overview of fractal math

### Fractal Art

- Enchanted World Gallery - I really like the ones that look like stained glass
- Stick Software Fracture Gallery is a beautiful gallery of fractals generated using the "Fracture" screen saver
- 3D Strange Attractors and Similar Objects - all I can say is "wow!"

### Reference

- How to Generate White Gaussian Noise - is the reference I used for generating my normal distribution
- Geometry of Self-Contacting Binary Fractal Trees - by mandelbrot and michael frame
- Iwate University CG - check out the 3D bonsai and other trees
- The Chaos Hypertextbook - by Glenn Elert, and is has the best notated reference of fractal programs for the Mac

## Tell me what you think!

Well, I have actually implemented user suggestions now (spectrum colour mode, predetermined random values) so please, if you have comments, suggestions, or even well-intentioned complaints, email me at sbwoodside@yahoo.com. I'm also especially interested in hearing about what you use the program for!

## Known issues with version 1.5

- Using Save as TIFF, with high values for "gro", the output file may contain images from the save panel. Use Copy and Paste as a work-around.
- New Tree is much slower than it used to be, for random trees.

## Version history

### Version 1.2

- copy the tree images into other graphics programs
- export the image as a TIFF file
- documentation under the "Help" menu
- user interface changes, hopefully it's easier to understand now
- information palette displays the numerical parameters for the current tree
- menu items are all enabled now, including Help
- colour options are on a drawer now (cool eh?!)
- randomness is now simpler to choose, with a pop-up menu
- fixed a bug that displayed the wrong depth, it's correct now

There are some other more subtle tweaks as well. For example, the "gro" slider gives you finer control over the larger-sized trees.

### Version 1.1

- Fixed bug in tree drawing code, during random drawing, resulting in the angle between two subbranches being always equal.
- I added the following colour styles: custom default, monochrome, gradient, and spectrum.
- A customize window for colour options: gradient start and end colours, background colour, monochrome colour, and transparency.
- Grow and Watch button flushes the drawing to the screen after each line, so you can watch the tree grow. This is much slower than normal drawing though.
- You can turn random on and off with a checkbox now.
- Depth is now set with an incrementer and you can type it in as well. It just makes more sense this way.

### Version 1.01

- Printing works properly now. When you print it will automatically scale the image to fit the page. You can print to "Preview" and save the PDF to save the image to disk.
- Little clean-up stuff, like turning off unused menu items, the about box, etc.

### Version 1.0

- Draw a fractal tree with 2 to 14 branches of height
- Adjust the breadth (angle term), fullness (length factor) and thickness (as drawn) in real time
- Zoom in and out
- Adjust the randomness of branch lengths and angles from not random to very random
- Scroll around the picture using the hand tool
- Print a high-resolution copy of the tree or save a PDF of the image

*Updated 2002/10/7*