CS 251: Assignment #3

Interactive Visualization II

For this assignment we'll make use of the view transformation process to allow the user to interactively manipulate the data. As we went over in class, we'll give the user the ability scale, translate, and rotate the view.


You should start this week by making a copy of your python program from week 2. Alternatively, you can download the skeleton file for project 3. You can also get the ViewRef class on request.

  1. If you have not already done so, make a method updateData for the application class that builds the view transformation, multiplies the original data by the view transformation and then adjusts the coordinates of the visible objects on the screen. You'll call this function each time you update the view transformation.
  2. Link motion in the left mouse button (button 1) to translation of the view reference point in the view plane. The motion of the VRP should be opposite that of the mouse so the data looks like it's following the mouse. (You may need to experiment with signs to get the directions right).

    Note that, for each of the listed tasks, the process for connecting user input to the motion of the VRP is outlined in detail in the lecture notes.

  3. Link motion in the right mouse button (button 2) to rotation of the VUP vector. You'll need to calculate the angle of the initial click relative to the center of the window and then rotate the data based on motion relative to that initial angle. The details are provided in the lecture notes.
  4. Link vertical motion in the middle mouse button (button 3) to scaling of the view volume extent. As the mouse moves up, the view should zoom in on the data (make the extent smaller). As the mouse moves down, the view should zoom out on the data (make the extent bigger).
  5. Enable your system to read in data files that have an arbitrary number of columns of data. Since your system is only able to plot 2 dimensions for now, you'll need to have a mechanism for picking which two dimensions to plot. You can default to the first two columns, if you wish. Doing something more complex is an extension.

    When executing the view transformation on your data, you will no longer be able to use the whole data matrix, however. Instead, you'll need to dynamically pick the parts of the data matrix that need to be transformed.

    It turns out this is trivial to do using the NumPy matrix class. You can select any set of four columns using the notation:

    m[ :, (a, b, c, d) ]

    where (a, b, c, d) is a tuple of integers. For example, if you have some 5D data plus a 6th column of all 1s, then you can use the following to plot the first column versus the second (our view pipeline ignores the third column for now).

    m[ :, (0, 1, 2, 5)]

    Ideally, you want to give the user the choice of which two columsn to plot against each other (it's the first extension listed). This will become much more important later as we move to real data sets.

    Test out your system on the following data file.


Some of these are holdovers from last week. If you've already implemented them, try something else. You're free to come up with your own if you have ideas about how to make your system better.


The writeup for each weekly project should be a brief summary of what you did along with some screen shots, graphs, or tables of results, depending upon the assignment. Please organize the writeup as follows.

  1. Title of the project and your name
  2. An abstract describing what you did in 200 words or less.
  3. A brief description of code you wrote or analysis you undertook for the project.
  4. Figures, screen shots, graphs, tables, or other results.
  5. A brief description of what you learned.


Make your writeup for the project a wiki page in your personal space. If you have questions about making a page, stop by during office hours 1-3pm on Mondays or Tuesdays.

Once you have written up your assignment, give the page the label:


Do not put code on your writeup page or anywhere it can be publicly accessed. To hand in code, attach it to an email and send it to the prof. Please do not copy the file into your email, but keep it as a separate attachment.