CS 2704 : Project #3


Assigned: November 11
Final Demonstration: December 9
Points: 50



Objectives

The objectives of the project are to:

These objectives will be achieved by the development of an extension to the drawing tool developed in Project #2 to incorporate a simple animation capability.

Description

Computer animation is the time-driven manipulation of a graphical representation. High-end animations, like virtual reality, cinematic effects, and scientific visualization, involve complex algorithms operating on detailed graphical images. Low-end animations use more modest graphical forms (wire frames) and simpler algorithms. However, all animations involve the two key elements of time and graphics.

In this project a simple animation capability will be added to the drawing tool developed in Project #2. Any shape constructed by the drawing tool will be animated in a uniform and simple way. The drawing tool's interface will be extended to allow the user to specify how a shpae moves from one position to another. A timer object (see below) will be used to advance the shape from its current position to its next position when the animation is in progress.

The key to the animation capability is how the user specifies the animation sequence - the sequence of positions at which the shape will appear. A simple method allows the user to click at a set of points on the drawing surface. These ordered points define the animation sequence. While there are more sophisticated methods for describing the animation, this method has the advantage of being simple and flexible.

From an object-oriented programming point of view the important idea is how the base class of shapes helps to include the animation capability efficiently. It is clearly inefficient to add animation functionality directly and repetitively to each specific shape subclass. However, when added to the base class, the animation functionality is inherited by all of its current (and future) derived classes. Depending on how the class hierarchy is defined and implemented, some changes in the class structure may be necessary to accomodate the new additions. But these changes, if any, will certainly be far less extensive than adding the animation code into each derived class separately.

The use of the base class to add the animation functionality illustrates one of the the important software engineering properites of inheritance: adding functionality to an existing systems (sometimes called perfective maintenance) can sometimes be accomplished very easily by exploiting the inheritance structure among a set of classes. In this way, inheritance is useful not only in designing and constructing a system but also in maintaining it.

Available Classes

The wxWindows class library contains several classes that are useful in doing this project. The wxPoint and wxList classes represents (x,y) coordinate pairs and lists that can hold such pairs. Together these two classes help form the animation sequence. The wxWindows class library contains the definition of two classes from which a timer for the animation can be constructed. The (slightly abbreviated) declarations of these classes are:

   class wxbTimer: public wxObject
   {
    public:
     ...
      wxbTimer(void);
     ~wxbTimer(void);
     ...
      virtual void Notify(void);                 // Override this member
      virtual int  Interval(void) ; 
   };

   class wxTimer: public wxbTimer
   {
     ...
    public:
      wxTimer(void);
     ~wxTimer(void);
      virtual Bool Start(int milliseconds = -1,Bool one_shot = FALSE ); 
      virtual void Stop(void);                
   };

These classes are described in the wxWindows on-line documentation in the wxTimer section. To use these timer classes you must include the header file "wx_timer.h".

The important thing to notice is that the wxbTimer class defines a virtual method "void Notify(void)" that is intended to be overridden by a user defined derived class. The Notify method is called at the end of the specified time interval. A default "do nothing" method is given in the base class. This method will be used if the Notify method is not overridden.

The availability of the timer classes illustrates again the utility of the inheritance mechanism. The designer of wxWindows was able to provide all of the machinery to implement a timer object. The user is able to derive a subclass that adds application-specific functionality without concern for how the inherited timer machinery works.

Programming Teams

The animation extension to the drawing tool will be developed by a team of two people. Each of the team members is expected to contribute equally to the development of the system. Each team member will receive the same grade for the project. A student should inform the instructor at the earliest possible time of a situation where the student's partner is not contributing equally to the project's development. It is considered a violation of the Honor Code to allow a team member to contribute less than an equal amount or to benefit unfairly from the work of another student. By default the teams for this project will be the same as for Project #2. Students may desire to change teams due to schedule conflicts with their current team member or to obtain the wider experience gained by working with as many different team members as possible. Please inform the instructor of any changes in a team or if you would like assistance in changing teams.

Evaluation

A live demonstration conducted in the McBryde 116 lab must be given by each team on the date of the final demonstrations. A sign-up sheet will be distributed in class prior to the date of each demonstration. Each team must sign up for one of the demonstration time slots.

A team's project will be evaluated by how well the team:

In addition to the live demonstration, each team must submit a printed listing of their code at the demonstration, The printed listing and the plans must give the name of the two team members. The evaluators reserve the right to deduct points for egregious violations of reasonable user interface standards or coding practices. The evaluators also reserve the right to award bonus points to teams that develop projects of clearly superior quality.