Tree
Since real tree head has changeable width, let's design function tree(x,z,h,w)
, the center trunk has height h, ground location (x,z), tree head is a little bit smaller than half the height, w is width of tree head on one side.
tree(x,z,h,w)
def tree(x,z,h,w): # w is width of tree head on one side
column(x,z,h, 22)
for i in range(x-w, x+w+1):
for k in range(z-w,z+w+1):
Y_tree_line(i, (int(h/2)+2), k, int(h/2), 8)
tree(40, -10, 15, 3)
===
Colorful trees
# tc: trunk color, lc: leave color
def treeColor(x,z,h,w, tc, lc):
column(x,z,h, tc)
for i in range(x-w, x+w+1):
for k in range(z-w,z+w+1):
Y_tree_line(i, (int(h/2)+2), k, int(h/2), lc)
# build some colorful trees:
treeColor(-0,-5, 20, 5 , 28, 9)
treeColor(15,-5, 20, 5 ,24 ,15)
treeColor( 30,-5, 20, 5 ,23 ,10)
(pic? colorTrees)
We have some trees, are you ready for a forest