Simple Dice
A while ago, my PhD supervisor Professor Nason was watching me using VRMath2 Editor. He saw that I could create a cube easily by clicking on the cube icon in the Shapebar, and I could apply a texture on the cube easily by clicking on the cube (select it) and then click on an image texture in the Texture Chooser in Property Inspector Window. However, when he asked me to create a dice, I could not do it quickly because an image texture will be applied to all the six faces of the built-in cube.
There are a couple of ways to create a dice. A basic one is to create 6 faces and apply an image texture on each of the 6 faces.
In VRMath2 Editor, there is a 2D primitive object called RECTANGLE, which will create a 2 x 2 square (a square is a rectangle) in the 3D space. Then I can apply an image texture by using the SETIT or SETIMAGETEXTURE command, or simply click on one image texture in the Texture Chooser (texture set 10, see the image below).
Below is a simple dice in 3D space, you can rotate it to check on the six faces. And by the way, do you notice how the six faces of the dice are arranged? There is a simple rule, or convention maybe, for the dice. For example, you probably cannot find a dice that has one and six be adjacent. Why? Leave me a comment if you know.
1. If you rotate a dice, the maximum number of faces you can see will be 3. Can you see 1, 3 and 5? 2. What about 2, 3 and 4? 3. Make a list of all the 3-face combinations you can see in this simple dice (you can check with this virtual dice after you have made the list). 4. Do you think the arrangement of numbers on the six faces are the same for all dice? 5. If you change the arrangement of the numbers, will you change the probability of each number being rolled? |
And of course you can write a Logo program to create this simple dice. I have the following example program for you to check, see if you can follow my thinking and do your mental rotations and movements.
; make a simple dice ; by Andy Yeh (2014) CS ; clear screen RESET ; reset any previous settings such as scale and material. FD 1 RECTANGLE ; create a rectangle face (2 x 2 square) at the turtle's location SELECT OBJECT ; select this rectangle object just created SETIT 10 12 ; apply image texture with index 10 12 (the one selected in the image above) BK 2 RECTANGLE SELECT OBJECT SETIT 10 17 FD 1 RT 90 FD 1 RECTANGLE SELECT OBJECT SETIT 10 13 BK 2 RECTANGLE SELECT OBJECT SETIT 10 16 FD 1 RU 90 FD 1 RECTANGLE SELECT OBJECT SETIT 10 14 BK 2 RECTANGLE SELECT OBJECT SETIT 10 15
- Andy's blog
- Login or register to post comments
- 6107 reads