Example: 3D Filled Trees
Filled triangles
TO tree clearscreen penup setpos [0 80] setfillcolor 4 repeat 6 [ setfillshade -6 + 3 * repcount ;repcount returns the current iteration back 4 * repcount fiso 8 * repcount 5 * repcount ;fiso = filled iso triangle lower 0.1 ] setfillcolor 8 setfillshade 5 back 50 slideleft 10 quad 20 50 ;trunk END
‘Tents’ – fiso prisms
TO tree3d cs pu setpos [0 80] ;cs = clearscreen ;pu = penup setfc 4 ;setfc = setfillcolor repeat 6 [ setfs -6 + 3 * repcount ;setfs = setfillshade bk 4 * repcount ;bk = back tent 8 * repcount 5 * repcount 10 lo 0.1 ;lo = lower ] setfc 8 setfs 5 bk 50 sl 10 ;sl = slideleft voxeloid 20 50 10 ;voxeloids are stretched cubes END
Cones
TO conetree cs pu setpos [0 80] setfc 4 up 90 repeat 6 [ setfs -6 + 3 * repcount ra 4 * repcount cone 8 * repcount 5 * repcount 20 ] setfc 8 setfs 5 ra 50 cylinder 8 50 20 END
Pyramids (5-sided ‘cones’)
TO pyramidtree cs pu setpos [0 80] setfc 4 up 90 repeat 6 [ setfs -6 + 3 * repcount ra 4 * repcount cone 8 * repcount 5 * repcount 4 ;while there is also a pyramid primitive, you can ;also create a pyramid by creating a 4-sided cone ] setfc 8 setfs 5 ra 50 cylinder 8 50 4 END
4-sided cones
TO tetratree cs pu setpos [0 80] setfc 4 up 90 repeat 6 [setfs -6 + 3 * repcount ra 4 * repcount cone 8 * repcount 5 * repcount 3] setfc 8 setfs 5 ra 50 cylinder 8 50 3 END