CS 106 Winter 2016

Lab 06: 3D


Question 1 Carousel



Create a sketch that displays a spinning 3D Carousel with horses. Follow the steps below:

  1. Open the Carousel sketch in the provided code and run it. The starter version loads a 3D horse model from an OBJ file in the data directory and displays it in the centre of the sketch window. Notice the use of the disableStyle() method, which allows us to override any default colours that ship with the 3D model.
  2. Using the same geometric context functions that you used in Lab 05 and Assignment 05, create a ring of eight horses nose-to-tail around the centre of the sketch. You will use ideas similar to the Dancers sketch from Lab 05, except that you'll have to use the 3D versions of the geometric context functions. You'll want to experiment a bit with positioning; just get to a point where the horses are always fully within the sketch window, and don't touch.
  3. Add a pole through the centre of each horse, as in the demo video above. Again, you may need to experiment a bit, nudging the pole in the x and z directions until it's roughly centred on the horse. It's easiest to use a tall, thin box() as a pole, but feel free to use some other long, thin shape, either defined in code or in an external 3D model file.
  4. Add a floor and a roof. These can be any shape you want, as long as
    • They're separated enough that the horses are clearly visible
    • The poles reach all the way from the floor to the roof (with no empty space above or below, so they look like they're attached)
  5. Add a central column, which again can be any shape you want. Like the poles, it must reach from the floor to the roof. It can pass right through them if you want.
  6. Give each horse a different colour. The easiest way to achieve this is to create a global variable holding an array of eight colors, and initialize the array with distinct colours in setup().
  7. Make the whole carousel rotate around its axis, as in the video above. The axis of rotation should be aligned with the vertical midline of the sketch. The technique is similar to that of the rotation of the Phyllotaxis in Assignment 05, but you can choose a single fixed speed.

Those are the main requirements for the question. Of course, there are many opportunities for optional enhancements if you want to play around.

Submission

Remember to review the Code Style Guide and use Processing's built-in auto format tool. Then review the How To Submit document. At the top of all of your source files, be sure to include a comment with your name and student ID number. When you're ready, zip up the entire L06 folder, which contains the Carousel sketch, and upload the file L06.zip to LEARN.