Lab#3B:  A Dynamic Scene Viewed from a Moving Camera with Perspective Projection


Goal: Create a moving-camera version of your planet-orbit systems in Lab#2.


  1. Think of this lab assignment as the fusion of what you have in Lab2 and Lab3A. For Lab2, you are able to view the dynamic moving plant-orbit systems from a fixed camera setting, while in Lab3A you are able to view several fixed 3D circles from a moving camera.


  1. Now we want to combine the features of Lab2 and Lab3A. Imagine that in Lab2 you want o observe the dynamic moving plant-orbit systems from the camera on a moving space ship. For simplicity, you may assume the spaceship is moving along an orbit plane centered at the origin and always look at the origin while it is moving. Like in Lab3A we want to allow the spaceship to be able to (i) get into one of the three orbit planes x=0, y=0, or z=0 by pressing either one of the three keys x, y, or z respectively, and (ii) increase or decrease the radius of the orbit by pressing the keys i or m respectively, and (iii) increase or decrease the speed of the spaceship on the fly by using the key board by pressing the keys j or k respectively.


  1. There are a lot of bells and whistles you can add into the basic framework above to create a nice spaceship’s view of your dynamic planet-orbit systems. It is up to you to use creativity in this process. Note: In its simplest form, you can still draw the plants as flat circles by calling your circle function as you did in Lab #2. But you can also adapt the code of icosahedrons-to-sphere in the book to create your own sphere function, and then draw the plants as spheres by calling  your sphere function.