Stephen Brown

Final Project - Creepy Tree


Program Description

The "Creepy Tree" program uses recursion to build a hierarchical model of a tree. The tree looks creepy so I named the program Creepy Tree. The model is built using cylinders, each with a top radius that is half the size of the bottom radius, which gives the cylinders more of a "branchy" look. Each branch sprouts two new branches that are 70% smaller than itself and rotated about the Z and Y axes. The angle of rotation about the z-axis is calculated as if the new branches were sitting on surface of their base branch as a cone (top radius = 0). This gives the look of each new branch growing out of the old. The rotation about the Y axis is a constant value. The tree consists of a total of 8 branch levels.

The tree also animates as if it is being blown by wind. There are three levels of wind. The first level acts as a light breeze and only affects the top branch level. The second level acts as a windy environment and affects the top 3 branch levels. The third level acts as a strong wind environment and affects the top 5 branch levels. The wind comes from either the left or right of the scene, depending on the user's preference, and travels along the x-axis, through horizontal the center of the scene.

The amount each branch moves away from its original position due to the wind is based on its position in the tree. I broke the tree up into 8 sections. The section of the tree that is affected most by the wind is the section directly facing the wind. The section that is least affected by the wind is the section directly opposite the wind. The others are somewhere in between based on their position. Each section's range of motion is based on this logic as well. The section with most affected by wind has the smallest range of motion to simulate more contact with the wind. The section least affected by the wind has the greatest range of motion to simulate less contact with the wind.

BLUE ARROW - wind from right
GREEN ARROW - wind from left
RED - Tree Section


Program Usage


Sample Screenshots

Note: without the animation it is hard to see differences in the screenshots

Creepy Tree - No Wind

Creepy Tree - Light Breeze

Creepy Tree - Windy

Creepy Tree - Strong Wind