cs349 - s10 - Lecture 29

CS349 - Implementing User Interfaces - Spring 2010

Public Service Annoucements

  1. Assignment 3 reminder.
  2. Assignment 4.

Lecture 29 - Drawing, Picking

Graphical User Interfaces

Last lecture we talked about points and vectors, how they transform.

How does this help us make graphical user interfaces (more precisely, interfaces that use direct manipulation)?

Let's think for a minute about assignment 4. What needs to be done?

  1. drawing
  2. selecting
  3. transforming

Here's how we do it.

  1. Base all things you draw on a small number of basic figures, such as
  2. Use transformations to turn this into any quadrilateral shape
  1.     

These are standard transformations. How do we do more interesting and useful work?

These matrices transform points and vectors. Let's see how we do drawing.

  1. Store the standard shape in terms of points and vectors.
  2. Know how to draw the standard shape in terms of its points and vectors.
  3. Store with it a transformation matrix that turns it into the actual shape.
  4. Draw the actual shape using the transformed points and vectors.

And let's see how we do the inside test. (We could just use the transformed points, but there's an easier way to do it.)

  1. Fact. The transformations above - when applied to a point and a shape - do not affect whether or not the point is inside the shape.
  2. This gives us two options for doing the inside test
    1. Transform the standard shape into the point's world, using the transformation matrix stored with the point.
    2. Transform the point into the standard shape's world, using the inverse of the transformation matrix.

    We prefer the second, because we can choose the standard object so that the inside test is easy.

Therefore store the inverse matrix with the shape, along with the transformation matrix.

Exercises.

  1. What is the inverse matrix of each of the basic matrices?
  2. How do we multiply inverse matrices?


Return to: