UNB/ CS/ David Bremner/ teaching/ cs4735/ milestones/ CS4735 Assignment 3

### Deliverables

Write your answers in Q{1,2,3}.{txt,odt,pdf}. You are welcome (and encouraged!) to use LaTeX, but please compile your TeX to PDF to save the TA trouble. You are encouraged, but not required, to provide sketches to help explain your answer.

### Part 1. Flying a camera

Suppose you have a 4x4 matrix `B` defining a camera coordinate system. The first 3 columns of `B` are mutually orthogonal unit vectors definining a left-handed coordinate system. The last column is a (homogeneous) point defining the eye point.

1. Show how to factor `B` into the product of a (homogenous) translation and an orthogonal matrix.
2. Use the results of of the previous part to show how to compute the view matrix `B^(-1)`
3. Suppose you have `B^(-1)` and want to change the eyepoint, keeping the axes of the eye coordinate system the same. What is the smallest number of scalar arithmetic operations (additions, subtraction, multiplication, division) you need to update the view matrix for the new eyepoint.

### Part 2. Multiple projections

Let `P(d)` and `O(d)` be the 4x4 matrices for perspective and orthographic projection onto the plane `z=d`. For each of the following pairs of projections, find a single matrix to carry out both projections in the order specified, and explain your answer in geometric terms.

1. First apply `P(d)` then `O(d)`.

2. First apply `O(d)` then `P(d)`.

3. First apply `P(d)` then `O(0)`.

4. First apply `O(0)` then `P(d)`.

### 3. Depth Transform

We have noticed several inconvenient side effects of the depth transformation

``````z' = n + f + nf/z
``````

It would be much nicer to have a transformation `P` such that

``````P [x,y,z,1]ᵀ =  [wx/z, wy/z, wz, w]ᵀ
``````

I.e. that did the required transformation to `x` and `y`, and left `z` alone. To avoid worries about dividing by zero, suppose we have the alternate form

``````P [x,y,z,w]ᵀ =  [λx, λy, λz², λwz]ᵀ      (1)
``````
1. Let `B` be the standard coordinate system (basis) in (homogeneous) matrix form. Use `(1)` to compute `PB`, then solve for `P`.

2. Show that this value of `P` does not perform the required transformation for all column vectors `[x,y,z,w]ᵀ`, i.e. that it does not faithfully impliment `(1)`