A pot of green

  • Email
  • Sharebar
  • Email
Andy's picture

It is hot summer (in Australia), plants and grass are quite stressed with dry and heat condition. Some succullent plants can survive easier, and I happen to see a pot of Snake plant, and think that I can create a 3D version of it.

There are many ways to model a 3D version of this plant. Not to bothered too much about the exact match, I thought that I could show some programming skills to create somewhat imaginary a pot of green. Below is the 3D version of it. 

Below is the short Logo programming for creating this pot of plant. Please read on for my explanation of programming.

As can be seen, there are comments explaining the use of a TRANSFORM as a parent to scale down the leaves, I will focus on explaining the REPEAT (loop) of this plant.

Let's first look at the REPEAT from line 16 to 22. Line 17 sets a random material for the rectanlge in line 18. The SETMAT command needs two inputs. The first one given is 12, and the second one will be ranging from 12 to 15. This is because that RANDOM 4 will generate a random number between 0 and 3. Then adding 12 will possibly become 12, 13, 14 or 15. The reason for doing this is to get 4 variations of green material from the Summer colors set shown in the Material Chooser (image below).

Property Inspector

Line 18 creates a rectangle. The RECTANGLE command by default, is a 2 x 2 rectangle. Therefore, in line 19, the turtle is moved up by 1 with RU 90 FD 1 RD 90, to reach the top of the rectangle. Then at this location, the turtle rolls up a random degree between -20 to 19 in line 20 so the next rectangle can be slightly curved. Line 21 again moved the thurtle up by 1, but with the previously rolled up angle. This move up by 1 ensures that the turtle moved to the center location for the next rectangle (remember that the rectangle is 2 x 2?).

Line 23 and 24 simply returns the turtle to home location and right turn a random degree between 0 and 359. This way, the turtle can draw  the next leave with 20 rectangles.

Got some questions? Please leave a comment or question below if any.

Files:  pot_of_green.x3d  pot_of_green.logo