previous

page 16

next
moving down
function tree() {
pu(); bk(350); pd();
fd(150); vee(100);
}
function test() {
tree();
}

Now to work on making the branches smaller as the tree "grows".

I plan to start with a width of 4 and reduce this by a factor of .8 each vee. You should be able to do this before clicking here to reveal my answer.

function vee(d,w) {
if (d>10) {
var f=.8;
pw(w);
lt(30);
fd(d); vee(d*f,w*f);
pw(w);
bk(d); rt(60);
fd(d); vee(d*f,w*f);
pw(w);
bk(d); lt(30);
}
}
function tree() {
pu(); bk(350); pd();
pw(4); fd(150); vee(100,4);
}

Notice how after each call to vee, I reset the width.

previous
next