While the project is designed so that you can do it without using arrays and pointers, you may use them if you like. However, my solution did not use any.
This assignment involves further development to a library of C++ routines stored in files drawings.h and drawings.cpp. You started developing this library in lab04. This project continues this development.
In this project you will add several capaibilities to this library, and then use the library in several main programs.
The project is divided into several stages. At each stage, you add a bit more capability to either the library (drawings.cpp/drawings.h) or to one or more of the main programs. At each stage, the total amount of credit you can possibly earn increases.
If you find that you are not able to complete the entire project, the intermediate stages provide places where you can stop, for partial credit. If you do decide to stop part way through, skip down to the step marked "Submission: creating your TAR file and updating your web page".
As with lab04, when you are finished, there will be a series of ".png" files that will show your final work. The links below show an example "before" and "after" group of .png files.
Before your changes | http://www.udel.edu/CIS/181/pconrad//06S/pngFiles/proj1.before |
After your changes | http://www.udel.edu/CIS/181/pconrad//06S/pngFiles/proj1 |
The following table shows a summary of the various stages in the project,
what
each one
involves,
and
the
partial
credit
involved.
Detailed
instructions
follow
this
chart:
picture |
before |
after |
step(s) |
drawFlags.png | (left to right) empty flag pole, german flag, empty flag pole, blank flag. | (left to right) US flag, German flag, French flag Texan flag | 1,7,8 |
drawHouses.png | 2 rows of 3 houses | 3 rows of 4 houses | 2 |
drawNewFeatures.png | does not exist | demonstration of your new features | 5 |
drawXXXXsPicture.png (change drawPhillsPicture.png to your own name) | A house, a stick figure, a stop sign, a flag on a flag pole, a snow man, a sun. | Five picture elements, at least two of which are your own creation. | 5,6 |
drawSnowMen.png | only 1 snow man, with no head |
three or more snowmen, at an angle off into the distance, each with a head, eyes, and a nose | 3,4 |
drawUSFlag.png | blank | a US Flag with 13 stripes and 50 stars. | 7,8 |
The project is divided into eight (8) steps. You should do the steps in order.
On the other hand, it is probably best to read over the entire
assignment before starting to code part 1, so you have some idea
of where you are going. Don't let the size or complexity overwhelm
you; working step by step, one step per day, you'll have no trouble finishing
on time if
you start NOW. So, with that advice, let's begin:
Copy the contents of the proj1 directory from the course web site to your own ~/cisc181/proj1 directory.
Those files can be found on strauss in the directory: /www/htdocs/CIS/181/pconrad/06S/work/proj/proj1
with the commands:
mkdir ~/cisc181/proj1 cp -r /www/htdocs/CIS/181/pconrad/06S/work/proj/proj1 ~/cisc181/proj1
Copy your drawings.cpp and drawings.h files from your completed lab04 over to your proj1 directory, overwriting the drawings.cpp and drawings.h files that are already there.
Do a "make clean", "make all", "make install". You should see that you now have a directory ~/public_html/cisc181/proj1 that contains PNG files created by your code.
They will resemble the files in the "before" directory for project1, except, if you did the steps in lab04 correctly, some changes will now be visible:
If that didn't happen, check with your TA or instructor before continuiing.
Now, add the calls into drawFlag.cpp to draw the French flag, where indicated. (This is just like what you did in lab04 to add the French flag into the drawNightFlags.cpp routine.) Do a "make install" and the flag should show up in the drawFlags.png file.In a later step, you'll fix the US flag as well; for now it will show up as a blank rectangle.
Note that of the 35% listed for step 1, only 5% of it is for the call for the French flag. The other 30% is divided as follows:
An overview of the grading rubric for this project appears at the end of this web page.
Modify drawHouses.cpp to draw three rows of four houses instead of two rows of three houses. This involves fixing up the for loops. Your drawHouses.png file should now look like the finished product.
Add a single for loop inside drawSnowMen.cpp to draw multiple snowmen in a line, going away at an angle, and of differing sizes. You'll use the loop variable to control the x and y coordinates as well as the size of the snowman. When you are done, the picture will look that the finished product, except there will be no eyes or noses.
Go into drawings.cpp and change code for drawSnowman to add code to draw the eyes and nose. You'll need to draw the eyes using another couple of calls to the routine that draws circles. You'll need to define the x and y coordinates, and the radius of the circles, in terms of the parameters to the drawSnowman function, so that the new feature work at multiple sizes... that is, big snowmen should have big eyes and noses, and small snowmen should have small eyes and noses.
When you are done with this step, the drawSnowMen.png file should look similar to the one in the "after" directory.
The drawings.cpp routine has code to draw the following features:
rectangles | stars | circles | flagpoles |
US flag | Texas flag | German flag | French flag |
houses | snowmen | stopsigns | stick figures |
Your job is to add two new features into drawings.h/drawings.cpp. You are going to use these features in Step 6, so read over all of steps 5 and 6 before proceding with Step 5.
One of the two new features may be taken from the following list of suggested items. The other feature should be something like this, but that does not appear in the list (something you dream up). Or, you may come up with two completely different items not in the list below.
(As a reminder: work independently. I would find it highly unusual if two folks were to choose exactly the same combination of two items, or to draw any particular item in exactly the same way!) But to ensure that that doesn't happen, I'm going to ask that you "register" your choice of what to draw on a discussion board in WebCT. First come first served in terms of what you choose to draw.
christmas tree | clouds | moon (crescent, not a simple circle) | yield signs |
birds | cats | dogs | regular tree (roundish at top with trunk) |
fire hydrants | ice cream cones | cars | trains |
a cartoon character such as: | a SpongeBob character | a South Park character | another geometric but challenging flag (e.g. Arizona, Colorado, Alaska, Puerto Rico. See http://www.fotw.net for decriptions of flags) |
The two new picture elements can be anything you like, subject to the following rules.
(1) When I say "anything"... Well, not _anything_. Try to stay
with the spirit of "grade school line drawings." If your drawing
appeared in a motion picture, that picture should get a G rating, or at the worst, PG (not PG-13 or R). While we want to
encourage free artistic expression, it would be a bad idea to "cross the
line" in terms of drawing something that might be perceived as offensive.
(2) Your two "new elements" don't have to be complicated, but they
should
different from each other. Don't just do two slightly different versions of the
same thing.
(3) One of your two could be an enhancement of an existing element (e.g. adding facial features or other detail to the stick figure, house, etc.). However at least one of your new elements should involve adding a new drawing function to the drawings.h and drawings.cpp file.
(4) Only one of the new features can be from my list of suggestions (unless you do, for example, two different cartoon characters from the same show.)
Change drawings.cpp/drawings.h to add routines for your two new picture elements.
Then, use drawSnowMen.cpp or drawHouses.cpp as a model to create a drawNewFeatures.cpp file. This file should draw a picture called drawNewFeatures.png that illustrates several examples of each of your new picture elements in various sizes (for example, a big SpongeBob, a little SpongeBob, and an in-between SpongeBob). This demonstration should show that your two new elements can scale in size and position. That is, you can draw them in a variety of x,y coordinates and in a variety of sizes, and they still look like the thing they are supposed to represent.
You'll also need to create a new files drawNewFeatures.sh, and add the necessary lines into the Makefile to support these files. Note that the drawNewFeatures.dat and drawNewFeatures.gnuplot should be created automatically by the code in drawNewFeatures.cpp.
When you create a new shell script called drawNewFeatures.sh, you might need to use the command:
chmod u+x drawNewFeatures.sh
to make the file executable before it will work properly. You can test the shell script separately from the Makefile by just typing the name of the file at the command prompt, just like you do with executable program files, e.g.:
./drawNewFeatures.sh
Now, change the name of drawPhillsPicture.cpp to drawXXXXsPicture.cpp where XXXX is your name.
Change the Makefile to support drawXXXXspicture, where XXXX is your name.
Now, customize your drawXXXXsPicture.cpp to make it YOUR picture. Your picture should be different from mine, and express your creativity in some way. It should contain at least your two new picture elements, and at least five different picture elements total (e.g. a house, a stick figure and a sun, and your two new ones.)
Again, keep it clean and try to stay somewhat within the boundaries of good taste.
Now change the drawUSFlag routine in drawings.cpp/drawings.h
to add the stripes and stars. You'll need one for loop for the short stripes,
and another one
for the long stripes. Finally, some nested for loops should work well for
drawing the stars.
The code contains the address of a web page that explains more about
how to draw the US Flag, and what the proper proportions are.
As you update the routines in drawings.cpp and drawings.h, you should see
the results reflected in both the drawUSFlag.png files,
and in the
drawFlags.png
file.
Note how the
structure
of the Makefile
is used to keep both sets of files up to date as changes are made to the
drawings.h and drawings.cpp file.
As you draw the USFlag the first time around, use the drawFivePointedStar
routine supplied. In the final step, you'll add a new routine, drawFivePointedOutlineStar
that will draw a proper "outline" star like the ones shown in the sample output.
Finally, develop a new routine drawFivePointedOutline star using the technique discussed in class, and replace the calls in drawTexasFlag and drawUSFlag with calls to these new routines.
Scripting your work and creating your tar file should follow the techniques learned in lab04, so refer back to that lab for details. Here is a summary of what is required of you:
ls -lh
to
see how large each file is in bytes, KB, MB, or GB.)Here is a summary of the grading rubric. TAs might indicate more detailed grading in their own rubrics.
Step | Item | Points | Running Total |
final | correctly creating tar file in final submission. tar file should not contain .o or executable files (i.e.you should do a "make clean" before creating it.) | 10 | 10 |
all | C++ style issues throughout: | 10 | 20 |
all | correctly scripting and following instructions generally (includes having web links to proj1 directory). | 10 | 30 |
1 | french flag show up in drawFlags.png | 5 | 35 |
2 | 3 rows of four houses in drawHouses.png, drawn with nested for loops in drawHouses.cpp | 5 | 40 |
3 | row of four snowmen on a slope, of different sizes, with heads, in drawSnowMen.png, drawn using for loop in drawSnowMen.cpp | 5 | 45 |
4 | snowMen in drawSnowMen.png have noses and eyes in reasonable proportions (i.e. anyone looking can tell they are eyes and noses on snowmen) | 5 | 50 |
5 | Two new features in drawNewFeatures.png. Makefile and scripts properly updated as well. | 20 | 70 |
6 | Student's own drawXXXXsPicture.png, .cpp, etc. | 10 | 80 |
7 | Drawing a proper US Flag with stars and stripes; shows up in drawFlags.png and drawUSFlag.png | 10 | 90 |
8 | Drawing the right kind of 5 pointed star (outline); shows up in drawFlags.png on Texas and USFlag, and in drawUSFlag on US Flag. | 10 | 100 |