Purpose: To getting a better understanding of vectors in three dimensions, we learn a little bit of computer programming. This lab represents the work done in learning some of the basic programming skills in VPython.
Getting The Hang Of Things
As soon as I watched the video about how to create 3 dimensional objects in space, I began to create 3 spheres in different positions. I didn't realize that the spheres would be in contact with each other.
I, then, reduced the size of the spheres to get a little separation. I could have also changed the position but for the sake of getting used to manipulating the spheres, I decided to see if I could change their size on the first try.
Next, I created an arrow attached to a sphere and pointed it in the negative x direction, to see how it looked.
Once I got the hang of manipulating the arrows, I began to orient them in the same manner as in the tutorial.
Once the arrows were positioned correctly, I changed the colors of the spheres and the arrows. The large amounts of red font shows my failure to produce a color that VPython could recognize.
After I finished changing the colors, I played around with the pound sign that allows me to ignore code. The pound sign highlights everything that proceeds it on the same line and does not use it for the program.
Then next step was to orient the arrows so that they may touch the neighboring spheres in a counter-clockwise fashion. It was a bit tricking, as I stumbled into some coding problems. I did not remember that when I give something a name, I can only recall it if the name was stated at the beginning. I fixed this by changing the structure of the lines and the program worked.
This picture shows how the arrows change when I push a sphere upward by double its distance. The arrows, definitely, change in length.
This shows how the print option works
This shows that I am using the newer version of VPython and can write the print option in either of the two ways shown.
Conclusion: VPython shows that it can be picky in the way the directions are organized but it is a great way to view a 3 dimensional object.
No comments:
Post a Comment