GUI Final -- Spring 2010

  1. This exam is open-note, open book. You may not use a computer or any electronic devices.
  2. You must answer all of the questions.
  3. Answer all the questions on the exam itself and hand in the exam.
  4. You must use Java to implement the coding questions.
  5. Well written code (e.g., with good variable names) will receive more credit than poorly written or poorly organized code.
  6. Well written and well organized explanations will receive more credit than poorly written or poorly organized explanations.
  7. Good luck!

  1. (24 points) Fill in the blanks for each of the following questions:
    1. _________________ Which cubic spline does not pass through any of its control points and provides C(0), C(1), and C(2) continuity?

    2. _________________ The model that divides behaviors into six separate actions called a start action, running action, stop action, abort action, outside action, and back inside action.

    3. _________________ The number of control points required to define a cubic spline.

    4. An interactor is implemented using a set of states and transitions that are collectively called a ___________________.

    5. ________________ Which cubic spline passes through its beginning and ending control points (but not its two intermediate control points) and provides C(0) and C(1) continuity?

    6. _______________ What Java command allows you to specify a clipping region that should be used by paintComponent?

    7. _______________ What is the minimum frame rate required to make the human brain think that it is seeing smooth, animated motion?

    8. _________________ What Java class is it recommended you use if you want to implement an animation?

    9. _________________ The technique to use if you want to inherit an object's implementation, but not its interface.

    10. An equation that defines a shape may have either the form F(x,y) = 0, in which case it is called an _______________ equation, or it may have the form x(t) = g(t), y(t) = h(t), in which case it is called a ________________ equation.

    11. __________________ The smallest polygon that will contain all of the control points of a geometric object.

    12. If a computer is too slow to provide smooth animation, an animator may create a few highly detailed frames, called ______________ frames, and then have a computer interpolate between the frames using simplifying assumptions, such as linear interpolation or derivatives.

  2. (4 points) For each of the following problems, circle either parametric or implicit to indicate whether the shape's parametric or implicit equation would provide the simplest method for solving the problem:

    1. parametric implicit Animatatedly moving an object around the boundary of a circle.

    2. parametric implicit Finding the distance of a mouse point from a line.

    3. parametric implicit Determining whether a mouse point is inside or outside a circle.

    4. parametric implicit Finding the nearest point on a cubic spline to a mouse point.

  3. (7 points) Suppose that you have a pre-existing spreadsheet application that runs only on MS Windows. You want to turn the spreadsheet application into a distributed application that will allow a group of people to collaboratively work on the spreadsheet. You also want the distributed application to work with any of the three major OS's (Linux, Windows, Mac). What is the simplest of the 5 distributed models for implementing this distributed application? Why?
    
    
    
    
    
    
    
    
    
    
  4. (7 points) Suppose that I was implementing a distributed, adversarial, multi-user game. Which of the 5 distributed models would probably be the best choice for implementing this game? Why?
    
    
    
    
    
    
    
    
    
    
  5. (5 points) Why does XOR allow me to draw and erase a single object without having to redraw the rest of the display?
    
    
    
    
    
    
    
    
    
    
  6. (10 points) For each of the following display situations, indicate whether you would use xor, clipping(#), or total redraw to redraw the display. If you would use clipping, indicate how many bounding boxes you would use.

    1. ______________ I am moving a feedback object around the display and nothing else in the display is changing.

    2. ______________ I have a boxes-and-arrows display that will typically have about 20 boxes and 50 arrows.

    3. ______________ I have a circuit diagram that may require anywhere from 10,000-1,000,000 gates and I want to redraw the diagram after moving a collection of 10 adjacent, and closely co-located, gates by 20 pixels to the right.

    4. I have a tiled gameboard that measures 10000x10000 tiles with characters that move from tile to tile. The tiles do not overlap and the display is large enough for the user to see a 100x100 subset of the tiles. Consider each of the following scenarios:

      1. _______________ A character moves from one visible tile to a horizontally adjacent and also visible tile

      2. _______________ A character moves horizontally by one tile, and in doing so, forces 5 new columns of tile to be scrolled onto the right side of the screen and 5 old columns of tile to be scrolled off the left side of the screen.

  7. (10 points) For each of the following scenarios, indicate which of the following interactor types would best handle that scenario:

    1. ________________ Move the hour hand of a clock.

    2. ________________ Sweep out a rectangle and select all the objects that intersect this rectangle

    3. ________________ Select a single object on the display and deselect whatever object was previously selected

    4. ________________ Implement the up/down arrow buttons in a scroll bar

    5. ________________ Implement the slider box in a scroll bar

  8. (6 points) If you are trying to design an interface that will enhance a user's productivity, will placing several simultaneous, unrelated animations around the display typically improve or diminish a user's productivity? Why?
    
    
    
    
    
    
    
    
    
    
  9. (7 points) Suppose I want to animatedly move an object in a straight line from the point (30,50) to the point (110, 80). Show me the equations I should use to do the animation as a function of time t, where t will vary from 0 to 1.

  10. (20 points) Write a Java paintComponent method that uses a Java Graphics2D object and Java2D transforms to draw the following picture of the 12 hours of a clock:

    To receive full credit your answer must use only one instance of a Java2D line and must use transforms.

    You should make the following assumptions:

    1. The length of the tickmarks is stored in a variable called length.
    2. Either the tickmarks at 3:00 and 9:00 or the tickmarks at 12:00 and 6:00 should touch the side of the panel, depending on which of the two dimensions of the panel is shorter.
    3. The figure is centered in the Java panel.

    Do not show me any code other than the paintComponent method. Here is the beginning of the code:

    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        // work on a copy of the graphics context
        Graphics2D g2 = (Graphics2D)g.create();
        // set up the dash in its own coordinate system
        Line2D tickmark = new Line2D.Double(0, 0, length, 0);