Project 2 / Phase 3

Project 2 Phase 3 - Theoretical Background

This written/theory homework is due Wednesday, March 17th before 2.30pm

If you write out the assignment by hand, you can either handin the paper in class, or place it in his mailbox on the 5th floor (remember, the elevators are locked after 5pm).

IIf you type your answer, you can email them to the TA make sure to include your name on the assignment.

Note: many of the questions here come from old exams and assignments, so you can find the answers on the web. We discourage you from reading the answers as you can't do so when taking exams./p>

We actually prefer if you leave your answer in fractional / irrational form. (So sqrt(3)/2 is preferred to 0.86602540378443864676372317075294.

Rotations are always counter clockwise. To see what the rotation around an axis does, stick your right thumb in the direction of the axis - your fingers will curl in the direction of rotation.


For questions 1-5, we consider a 2D graphics system that works like OpenGL. It uses 3x3 homogeneous matrices and a post-multiply convention. It has a matrix stack, and supports the following commands:

PUSH – makes a copy of the top element of the matrix stack
POP – removes the top element of the matrix stack
TRANS(x,y) - translates by x,y
ROT(t) - rotates counter clockwise by t degrees
SCALE(x,y) - scales by x,y
SQUARE - draws a unit square between (0,0) and (1,1)

Here is an example program and its output:

Draw Square
PushMatrix
Scale(2,2)
Translate(2,1)
Scale(-1,1)
Draw Square
PopMatrix
Rotate 90
Translate -3,0
Draw Square

Question 1:

If we had left out the PushMatrix/PopMatrix commands in the example program, the last square would have appeared in a different place. Where would it have been?

(give the positions of its 4 corners)

 

Question 2:

Write a program that creates the following picture, without using PushMatrix or PopMatrix.

 
 

Question 3:

When dealing with images, we often like to measure the screen in pixels (with 0,0 being the upper left, and width-1, height-1 being the lower right). When dealing with geometry, we often like to have “Normalized Device Coordinates” where the center of the window is 0,0, and 1,1 is the upper right corner (and -1,-1 is the lower left).

 

Question 3A:

Using the 2D transform commands above, write a program that creates the transformation from normalized device coordinates to pixel coordinates for a screen that is 640x480 pixels on the top of the stack. (your answer should be a sequence of commands)

 

Question 3B:

If the screen is 640 by 480 pixels, what would the matrix be? (your answer should be a 3x3 matrix).

Hint: it is probably easier to figure out the answer directly than to multiply out the matrices.

 

Question 4:

Give the 3x3 matrix that would transform the unit square (with one of its corners at 0,0, and the opposite corner at 1,1) such that: The corner that was at the origin goes to 1,2. The corner that was at 0,1 goes to 3,4. The corner that was at 1,1 goes to 5,6.

 

Question 5:

Give the program that creates a rotation of 45 degrees around the point 3,4.

 

Question 6:

Consider the desk lamp in this picture:

TThe lengths of the arms are 5, and the tip of the bulb is 1 unit from the joint. x,y, and theta 0-3 are all parameters to position the lamp. Write an expression that computes the position of the bulb (point B) in the coordinate system of the desk. Your expression should be the product of a set of Matrices T(x,y,z) (that translates by x,y,z) and Rx(theta) that rotates theta degrees around the x axis (or Ry or Rz). These matrices are post-multiply and the rotations are measured counter clockwise in right-handed coordinate systems.

Question 7

Write a parametric function for the curve consisting of three line segments connecting the four points (0,0), (1,0), (1,3), (3,3). Have the paremeterization be unit (e.g. from 0 to 1) and arc-length parameterized./p>

((remember: arc-length parameterization means that the "speed" of the parameterization is constant, not necessarily unit)

Question 8

A Segment of a Catmul-Rom cubic (in 2D) has its control points at (0,0), (0,2), (4,2), and (4,1). A point moves along this curve, starting at the begining at (t=0) and getting to the end of the segment at (t=1). The point moves with a constant rate of change in its parameters./p>

Question 9

We have a 5th order (4th degree) Bezier curve segment with control points (0,0), (0,2), (2,4), (4,2), (4,0). We want to connect a degree 3 (cubic) Bezier to this curve so that the two curves form a closed loop (the beginning of one curve is the end of the other), that has C(1) continuity. Where would the 4 control points of the curve go?

Question 10

Divide the 5th order curve in Question 7 into two 5th order curves, splitting the curve at its half-way point. (hint: use thespan class="Apple-converted-space"> DeCastlejau algorithm)