Assignment 2 - Animate a Clock Escapement

Due Date: Thursday January 25. 11:59PM

In this assignment you to gain experience working with transformations. We'd like you to animate a pendulum clock in OpenGL by setting up a hierarchy of transformations that properly place the various components of the clock on screen. In this assignment you'll also learn to work with several classes from the Stanford Toolkit (ST), these classes provide the ability to save and load shapes and images from disk, as well as organize the components of a scene into a scene graph.

About Clock Escapements

In high school physics, you might have done an experiment showing that the period of a swing of a pendulum is only dependent on the length of the pendulum. Because of this property, pendulums have been used to accurately keep time. In a pendulum clock, a device called an escapement utilizes the regular swing of the pendulum to limit the speed at which a gear turns. This gear drives other gears which spin the various hands of a clock. Take a few minutes to read the simple explaination of how pendulum clocks work at HowStuffWorks.com.

In this assignment you will animate a pendulum clock with two hands (second and minute hands).

Steps

Download and build the starter code

  1. Download the assigment 2 starter code and Stanford Toolkit source files here. This code contains the complete version of 'libst' as well as starter code for this assignment.

  2. Build libst. libst source code is located in the /libst subdirectory. In this directory there is a Makefile for building with g++ on Linux. Solution files for Visual Studio 2003 and 2005 are located in the /libst/vc2003 and /libst/vc2005 directories respectively. A Visual Studio build of the library should result in the creation of /libst/lib/libst.lib (or libst.a when using g++).

  3. Build the clock application. The starter code for assignment 2 is located in the directory cs148code/assignment2. In this assignment you will need to modify clock.cpp to produce your clock animation. This directory also contains a number of text files with a .shp extension. These files describe 2D shapes that can be loaded and drawn by the STShape class. Again g++ Makefile or Visual Studio project files for VS 2003 or VS 2005 are provided so your should be able to build the clock application out of the box. Running the provided sample code should draw two gears (big yellow one and a tiny blue one), a brown rectangle, and a brown circle on the screen.

Understanding the Stanford Toolkit

Draw the Clock

  1. Draw the pendulum
  2. Draw all three gears
  3. Draw the second and minute hands

Animate the clock

Save your animation

Grading

Submission Instructions

Additional Resources

last edited 2007-01-31 19:52:19 by rescomp-03-61109