CS-560, Assignment # 6
Due Date: 4-12-02

In this assignment you are to use viewing transformations in conjunction
with line and polygon clipping to animate a polyline-based scene and a 
polygon-based scene with the techniques of panning and zooming.

PANNING. We can cause the image of an object such as a polyline or
polygon appear to move horizontally (vertically) across a screen viewport
by using a series of windows, each displaced a small amount horizontally
(vertically) with respect to its predecessor. When we perform the window-
to-viewport transformation for each new window, clip the resulting
device-coordinate polyline or polygon to the fixed viewport, and then
display it, we will obtain a series of images that show the polyline or
polygon moving across the viewport in the opposite direction of the
motion of the window.

ZOOMING. We can cause the image of an object, represented by a series of
polylines or polygons, to appear to grow larger within a screen viewport
by using a series of windows, each slightly smaller than its predecessor.
When we perform the window-to-viewport transformation for each new
window, clip the resulting device-coordinate polyline or polygon to the
fixed viewport, and then display it, we will obtain a series of images
that show the object growing in size within the viewport.

You are to implement panning and zooming on a polyline (or series of
polylines) and then on a polygon (or series of polygons) that represent
some scene. Specifically you should write a Visual C++ MFC program
that does the following:

PANNING:

1. Set up a convenient viewport in the middle of the window's client area
(i.e., define xvmin, yvmin, xvmax, yvmax, as described in class). The
viewport should not be the entire client area.

2. Define one scene as a polyline or series of polylines and another scene 
as a series of polygons in some convenient world coordinate system (xw, yw).
This coordinate system should use floating point numbers for values of xw
and yw. The yw axis should point upward.

3. Set up an initial world coordinate system window (xwmin, ywmin, xwmax,
ywmax, as described in class) such that your polyline scene lies wholly 
above the top of the window.

4. Set up a loop that:

   (A) Performs a window-to-viewport (viewing) transformation on each
   line of the world coordinate system for the scene represented with
   polylines.

   (B) Clips each line segment constituting your transformed scene to the
   viewport using the Cohen-Sutherland line clipper described in class.

   (C) Displays your clipped scene in the viewport. (The viewport
   boundaries should also be displayed.)

   (D) "Moves" the clipping window a small distance up.

   (E) Erases your scene from the viewport.

The loop should continue until the window has "moved" so that your scene
lies wholly to the below the window.

Repeat the above procedure on the scene represented with polygons,
using the Weiler-Atherton clipping algorithm (described in class) to
perform the clipping of each polygon in your scene.

ZOOMING:

Repeat steps 1 and 2 above

3. Set up an initial world coordinate system window (xwmin, ywmin, xwmax,
ywmax, as described in class) such that your scene lies wholly inside the
window and is very small compared to the dimensions of the window
(perhaps the size of the window should be about 5 times the size of
your scene). Your scene should be more or less centered in the window.

4. Set up a loop that:

   (A) Performs a window-to-viewport (viewing) transformation on each
   line of the world coordinate system for the scene represented with
   polylines.
   (B) Clips each line segment constituting your transformed scene to the
   viewport using the Cohen-Sutherland line clipper described in class.

   (C) Displays your clipped scene in the viewport. (The viewport
   boundaries should also be displayed.)

   (D) Reduces the size of the window, maintaining your scene centered.

   (E) Erases your scene from the viewport.

The loop should continue until the window is considerably smaller than
your scene (perhaps 1/5 the size of your scene).

Repeat the above procedure on the scene represented with polygons,
using the Weiler-Atherton clipping algorithm (described in class) to
perform the clipping of each polygon in your scene.


NOTE:

To implement the viewing transformations, you can use the result derived
in class for the x-coordinate equation, but you will have to derive the
correct y-coordinate equation because of Windows' downward-pointing y-
axis.)