Compute overall scale factors by raising the scale factor

Assignment Help C/C++ Programming
Reference no: EM13896117

The third project builds on the second project by adding the ability to specify animations of the transformations. The UML diagram for the new version of the project is shown below:

1305_UML diagram.png

All the classes shown in black are unchanged from project 2. There is only one new class shown in red, Animator, which should be a singleton object. It should keep track of whether an animation is currently in process and if so, what step of the animation is currently being drawn. It should have functions to start, pause, and reset the animation. These functions need to be called by the keyboard callback function. It should also have a function to advance to the next step of the animation, which should be called by the timer callback function. Finally it needs functions to return whether an animation is in progress and one to return the current step of the animation. Those functions will need to be called by the Transformation class.

The remaining classes shown in blue will require the following modifications:

1. Two new callback functions must be added to the main project3.cpp source file. The first function is one that is called when a timer is fired. If the animation is running it advances to the next step by calling the appropriate function in the Animator class described above and then redraws the scene. The second is one that is called when a character is typed on the keyboard. It should start the animation when the letter s is typed, pause it when p is typed and reset the animation back to the initial state when an r is typed. Callbacks for both of these functions must be registered in main.

2. The Parser class must be modified to add the option of including animation steps on each transformation. The revised grammar is shown below, with the change highlighted in red:

scene -> SCENE IDENTIFIER number_list graphics END '.'
graphics -> graphic graphics | graphic
graphic -> text | transformable_graphic transformations END
transformable_graphic -> isosceles | parallelogram | regular_polygon
isosceles -> ISOSCELES COLOR number_list ANGLE NUMBER ';'
parallelogram -> PARALLELOGRAM COLOR number_list ANGLE NUMBER ';'
regular_polygon -> REGULAR_POLYGON COLOR number_list SIDES NUMBER RADIUS NUMBER ';'
text -> TEXT COLOR number_list AT number_list STRING ';'
transformations -> transformation transformations | transformation
transformation -> action steps
action -> rotation | scaling | translation
steps -> STEP NUMBER TO NUMBER ';' | ';'
rotation -> ROTATE ANGLE NUMBER
scaling -> SCALE number_list
translation -> TRANSLATE number_list
number_list -> '(' numbers ')'
numbers -> NUMBER | NUMBER ',' numbers

The modified parser and corresponding token file are provided in the attached .zip file.

3. TheTransformation interface from project 2 must now become an abstract class, which now will contain an overloaded function transform, which is not a virtual function. It should determine whether the animation is currently running and if necessary, invoke the virtual transform function supplying it the current step of the animation.

4. The Rotation class must be modified so the the transform function computes the total rotation angle by multiplying the angle of rotation by the step of the animation, before performing the rotation.

5. The Translation class must must be modified so the the transform function computes the total translation distances by multiplying the translation distances by the step of the animation, before performing the translation.

6. The Scaling class must must be modified so the the transform function computes the overall scale factors by raising the scale factor to the power defined by the current step of the animation.

Sample Input and Output

Below is a sample of a scene definition file that would provide input to the program:

Scene Polygons (500, 500)

Parallelogram Color(0.0, 1.0, 0.0) Angle 80;

Scale (20.0, 20.0);

Translate (-0.2, 0.2) Step 1 to 25;

Scale (1.3, 1.3) Step 25 to 28;

Rotate Angle 30 Step 31 to 42;

End

Isosceles Color (0.0, 0.0, 1.0) Angle 90;

Scale (1.5, 1.5) Step 61 to 71;

Translate (0.1, 0.1) Step 72 to 80;

Rotate Angle 45 Step 81 to 84;

End

RegularPolygon Color(1.0, 0.0, 0.0) Sides 4;

Scale (50.0, 50.0);

Rotate Angle 36.0 Step 91 to 100;

End

Text Color(0.0, 0.0, 0.0) at (5.0, 150.) "Hello World";

End.

Shown below is a Flash movie of how the above input should look when run.

Attachment:- cp.zip

Reference no: EM13896117

Questions Cloud

Proper coding conventions required the first letter of class : The files must be called  (driver) (handles house variables and methods) Proper coding conventions required the first letter of the class start with a capital letter
Is the information contained in the articles reliable? : Is the information contained in the articles reliable? Explain
What does the result of part a tell us : A random sample of 64 with a mean of 50 and a standard deviation of 20 is taken from a population of 800. Find an interval estimate for the population mean such that we are 95% con?dent that the interval includes the population mean.
What is the main advantage of assessing the welfare impact : What is the main advantage of assessing the welfare impact of a merger by looking at its ‘external effect'? Explain in words the condition under which this external effect is positive.
Compute overall scale factors by raising the scale factor : Finally it needs functions to return whether an animation is in progress and one to return the current step of the animation. Those functions will need to be called by the Transformation class and the Scaling class must must be modified so the the ..
Establishing families through adoption : One can consider the financial status of fathers; fathers stepping up and taking on the role and regaining their parental rights; and, gay men are more open and accepted to live their lives freely by establishing families through adoption.
What is the fetishism of commodities : What is the fetishism of commodities, where does it come from, and how does Marx establish the existence of the fetish aspect of the commodity? Be sure to relate the concept of commodity fetishism to the discussion of the value and exchange value ..
Reggit company held the following short term investments : Prepare the December 31, 2013, adjusting entry to report these investments at fairvalue.
Explain why competition authorities encourage colluding firm : Explain why competition authorities encourage colluding firms and their employees to report incriminating evidence through leniency and whistleblowing programmes.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd