Saint Louis University |
Computer Science 1050
|
Dept. of Math & Computer Science |
For this assignment, you must work individually in regard to the design and implementation of your project.
Please make sure you adhere to the policies on academic integrity in this regard.
You are to design an interactive sketch depicting the horizon. The top half of the sketch will represent the sky and the bottom half the ground. The exact y-coordinate of the horizon should be a variable in your code. This will be a horizon line at which all objects appear to vanish in the distance. Color and decorate the top and bottom of your sketch appropriately. You are welcome to have distant aspects of the ground, such as a mountain, cross the horizon if you choose.
Your sketch must be interactive, as follows. When the user clicks on the sketch, you are to draw one of two types of objects. If the click occurs in the sky (i.e., above the horizon line), draw an object that belongs in the sky at that point (e.g., a cloud, bird, plane, hot-air baloon, ...). Alternatively, if the click is below the horizon, draw something that belongs on the land (i.e., an animal, flower, building, ...). The size of the added objects should depend linearly upon the distance from the mouse click and the horizon, such that items shrink to near zero size as they approach the horizon.
For the sake of creativity, your objects and landscape for this project should be different from anything you may have created for the first project.
Here is my own interactive example, inspired by the annual balloon glow (even though its actually held in Forest Park, not by the Arch). You may reset the sketch by pressing the 'r' key.
For full disclosure, I will note that I used rather advanced techniques to achieve the effect of the arch being in front of some objects and behind others; I would not expect you to create such an effect with the techniques we've learned thus far. A still frame created with my software is as follows.
Note well the vanishing effect, in that the size of objects gets infinitesimally small as they get closer to the horizon.
If you would like a little more inspiration, feel free to check out last year's students' projects (but please note that not all of them implemented the perspective properly).
Your sketch must meet the following technical requirements:
We suggest you use the following structure for your program.
// Header comments // Declare global variables void setup() { // Set up the drawing. // Draw the sky and the ground and any other default scenery } void draw() { /* remains empty */ } void mousePressed() { // Use the mouseY position to decide whether drawing on sky or on ground // Compute scale factor and call appropriate drawing function. } // You may rename this function, depending on what you choose as your sky object void drawBalloon( int x, int y, float scale) { // Draw a balloon at the given coordinates using the scale factor. } // You may rename this function, depending on what you choose as your sky object void drawPerson( int x, int y, float scale) { // Draw a person at the given coordinates using scale factor. }
Please see details regarding the submission process from the general programming web page, as well as a discussion of the late policy.
For this project, we ask that you submit the following three files:
save("filename.jpg"); // or any other such filenamewhen a particular key is pressed, so that you can wait to generate the image until after you add several examples of your objects.
The assignment is worth 70 points, which will be assessed as follows:
An unspecified number of bonus points are available for anyone who clearly goes above and beyond the set of requirements in terms of difficulty, artistry, or creativity.