Ice Cream Cone
Hello, I have created an ice cream cone and I would like to show you how I did it. This simple ice cream cone has a cone and a sphere. The cone and sphere will overlap (intersect) a little bit. In this virtual ice cream cone, I have used both the graphic user interfaces (GUIs) and the Logo programming. When I completed it, I saved the Logo program (.logo file), the 3D world (.x3d file), and a screenshot (.png file) so I can show you in this blog.
I created this ice cream cone by inserting an up-side-down cone and move up the turtle just 0.7 metres to place a ball (sphere). You can use mouse to drag in the 3D space below and examine the ice cream cone from any viewpoints you like.
Below is my Logo program.
; Ice Cream Cone ; By Andy Yeh (2014) CS RESET TILTRIGHT 180 CONE SELECT OBJECT SETIMAGETEXTURE 0 33 UP 0.7 SETMATERIAL 6 24 BALL
In order to have an up-side-down cone, I TILTRIGHT 180 the turtle first so the cone. I guess if I TILTLEFT 180 instead of TILTRIGHT it will be still fine. But what about just LEFT 180, or RIGHT 180? Or what about ROLLUP 180 or ROLLDOWN 180?
To apply an image texture on an object is also easy. In line 6, I use SELECT OBJECT to simulate using a mouse to click on the cone created. SELECT command needs an input as the object's id. Command OBJECT will provide the id of the object just created. Therefore, SELECT OBJECT will be just like using the mouse to click on the latest created object.
In line 7, the SETIMAGETEXTURE (or SETIT) will apply an image texture onto the selected object according to the two inputs. The two inputs of SETIT are the set number and the item number in the Texture Chooser in the Property Inspector window. You can move the mouse over any image texture in there and it will show you the numbers you need.
In line 8, I command the turtle to move UP 0.7 metres, to the place where I want to place the sphere. Please note, at the time the turtle has tilted right 180, and has it back (shell) to the ground. But because UP is a fixed direction related to the world (or the creator), not the turtle, so even the turtle was still up-side-down, it will still move towards the sky (up) direction.
Then before I insert a ball in line 10, I used a SETMATERIAL (or SETMAT) command to choose a material setting in line 9. SETMAT command needs two inputs similar the SETIT commands. I found out the two numbers by moving my mouse over the material I want in the Material Chooser in Property Inspector window.
There is an important difference between applying image texture and applying material setting in Logo programming. Please remember that image texture is applied after the object created (so need to SELECT OBJECT), and material settings can be applied before or after object is created.
So, this is how I did. Hope you enjoy reading my blog. Please leave a comment.
Files: icecream.x3d icecream.logo
- Andy's blog
- Login or register to post comments
- 4473 reads