Home > other >  Help solve the problem of Turtle drawing
Help solve the problem of Turtle drawing

Time:09-29

The fractal tree
Step 1:
Using Turtle draw as shown in this illustration - 1 the fractal tree,
Requirements:
Tree trunk upward growth;
Fractal layer is 4, binary tree;
The first layer of branches length of 60, step by step a minus 6;
Any Angle around the branches, the final effect looks almost the same as shown in figure 1,
Must be able to see the drawing process,



Figure 1
Step 2:
A, modify raw ingredients form tree method in step 1:
Parting layer as a random number between 4 ~ 6;
The first layer of the branches as a random number between 30 ~ 60 long;
Second, drawing fractal trees
In 800 x600 screen drawing fractal trees;
The number of 50;
Each fractal tree roots location for screen within the scope of random coordinate points, the branches of the allowed out of the screen outside the window;
Vertical lines at the center of the screen as the boundary, trees leaning in the left of the screen, the screen on the right side of the trees lean to the right;
Create the instantaneous (that is, can't see the drawing process),
Overall drawing sample shown in this illustration - 2, for example,



Figure 2 drawing fractal trees sample
And painting process instantaneous process (see drawing)
  • Related