Resizable Christmas tree
This is a simple Christmas tree consists of a cone and a cyliner. In order to create multiple trees with different sizes, I have included an input into the tree procedure.
The original tree procedure create a tree, which is 3.25 meters tall. Can you figure out 3.25 meter from the codes below?
TO tree ; tree procedures SETSCALE .15 2 .15 RU 90 FD 1 RD 90 SETMAT 0 27 CAN SETSCALE 1.5 2.5 1.5 RU 90 FD 1 RD 90 SETMAT 0 21 CONE END CS tree
In order to create different sizes of tree, I modified the procedure to include an input call :size. As can be seen, the :size is multiplied to the scales and the movement of changing position.
; Christmas tree with a :size input ; By Andy Yeh (2013) TO tree :size ; tree procedures SETSCALE .15*:size 2*:size .15*:size RU 90 FD 1*:size RD 90 SETMAT 0 27 CAN SETSCALE 1.5*:size 2.5*:size 1.5*:size RU 90 FD 1*:size RD 90 SETMAT 0 21 CONE END CS WEST 2 tree 0.5 HOME tree 1 HOME EAST 2 tree 1.5
At the end of this program, I created 3 trees with 3 different sizes. The 3D world is as below:
Let me know what you think in the comment below.
Files: christmas_tree.x3d christmas_tree.logo
- Andy's blog
- Login or register to post comments
- 4046 reads