A picture of a tree, drawn using fractal or mathematical methods. It is relatively easy to write a computer program to draw a tree when one realizes how self similar a tree is. The twigs on trees look like the branches on which they grow, and the branches look like the trunk. One could write a function "Branch" which simply draws one branch, and then calls copies of itself to make sub-branches on that branch.
In C'ish pseudo-code, a simple 2d example:
--------------
#include "math.h" // for the trig stuff and random number generator
#include ??? // whatever you need to do graphics on your platform
void Branch(int x, int y, float len, float angle)
// x,y are the starting coords on screen,
// len is the branch length in pixels,
// and angle is the angle of the branch in radians.
{
int color,x2,y2; // branch color and endpoint..
float childlen; // the length of any children off this branch..
float childangle; // the offshoot angles of any children
if(len>3) // if its a long branch, make it brown.
color=BROWN;
else
color=GREEN; // otherwise make it green.
// draw the 'branches' and 'leaves' as a simple lines.
// Get more fancy than this, please.
x2=x+len*cos(angle);
y2=y-len*sin(angle);
DrawLine(x,y,x2,y2,color); // draw branch
if(len>3) // if this branch is long enough to have children...
{
childlength=len*(float)(rand()%80+10)/100.0;
childangle =3.14159/2.0*(float)(rand()%100)/100.0;
Branch(x2,y2,childlength,angle-childangle);
Branch(x2,y2,childlength,angle+childangle);
}
}
void main() // time to plant our tree
{
// set up your graphics here...
// ...648x480 pixels, for example..
Branch(320,480,100,3.14159/2.0); // and get to it!
Wait_For_Keypress(); // all done.
}