--------------------------------------------------------------------------------
Problem 1

1.

A is (512 * 4)^2 / 8 bytes == 512^2 * 2 bytes
B is (512 * 2)^2 bytes     == 512^2 * 4 bytes
C is                          512^2 * 3 bytes

Thus the order is A, C, B.


2.

i. C (because a color device needs a color image)
ii. A (because a laser printer is a high resolution bitmap device)
iii. B (because CRTs are continuous tone devices)


--------------------------------------------------------------------------------
Problem 2

1.

The image is the halftone dot pattern enlarged by a factor of 100 (and also
flipped upside down and backward, but you can't tell because of the symmetry
of the pattern).  If you look at the image you see big black circles, 3 across
and 3 down:

2.

With 102 dpi, the effect is the same but the enlargemnt factor is 50.  So you
see a pattern of 6 x 6 black circles that are half the size of the ones in
part 1:


--------------------------------------------------------------------------------
Problem 3

Here are two popular correct approaches to this problem, with some common
variants:

1. Keep exactly the same loop, check d against subpixel cutoffs on output

drawLine(int x0, int y0, int x1, int y1)
   float m = (x1 - x0) / (y1 - y0)
   int x = x0
   int y = y0
   float d = m
   output(x0,  y0, WHITE)
   while y < y1
      if d > 0.5
         x += 1
         d -= 1
      y += 1
      d += m
|     if (d < -1/6)
|        output(x-1, y, BLUE)
|        output(x, y, YELLOW)
|     else if (d > 1/6)
|        output(x, y, CYAN)
|        output(x+1, y, RED)
|     else 
|        output(x, y, WHITE)


1a. variant with all positive cuttoffs

   ...
   while y < y1
|     if d > 5/6
         x += 1
         d -= 1
      y += 1
      d += m
|     if (d < 1/6)
|        output(x, y, WHITE)
|     else if (d < 1/2)
|        output(x, y, CYAN)
|        output(x+1, y, RED)
|     else 
|        output(x, y, BLUE)
|        output(x+1, y, YELLOW)

2. Rasterize with slope multiplied by 3, keeping a subixel and full-pixel
   x coord

drawLine(int x0, int y0, int x1, int y1)
|  float m = 3 * (x1 - x0) / (y1 - y0)
   int x = x0
   int y = y0
   float d = m
   output(x0,  y0, WHITE)
|  int sx = 0
   while y < y1
      if d > 0.5
|        sx += 1
|        if (sx == 3)
|           sx = 0
|           x += 1
         d -= 1
      y += 1
      d += m
|     if (sx == 0)
|        output(x, y, WHITE)
|     else if (sx == 1)
|        output(x, y, CYAN)
|        output(x+1, y, RED)
|     else 
|        output(x, y, BLUE)
|        output(x+1, y, YELLOW)

2a. same code but with the original m and:
    "d > 0.5" -> "d > 1/6"
    "d -= 1"  -> "d -= 1/3"

2b. equivalent code storing and incrementing 3*x and using (x/3) and (x%3)
in drawing -- not quite full credit because of division in inner loop.

2c. equivalent code storing floating-point x and incrementing by 1/3, then
comparing frac(x) against 0, 1/3, 2/3 -- not quite full credit because of
issues with equality comparisons of floating-point numbers.  But could be
considered shorthand for the version with x and sx.


--------------------------------------------------------------------------------
Problem 4

Although I was looking for the form shown here I also accepted the answers in
terms of "sin 30", "cos 45", etc.

1a.
[1 0 3]
[0 1 2]
[0 0 1]

1b.
[sqrt(2)/2 -sqrt(2)/2 0]
[sqrt(2)/2  sqrt(2)/2 0]
[    0          0     1]

1c.
[1.4 0 0]
[ 0  1 0]
[ 0  0 1]

1d.
[sqrt(3)/2   -1/2    4]
[  1/2     sqrt(3)/2 0]
[   0          0     1]

1e.
[sqrt(3)/2   -1/2    2*sqrt(3)]
[   1/2    sqrt(3)/2     2    ]
[    0         0         1    ]

1f.
[sqrt(3)/2    -1/2   -2*sqrt(3)+4]
[   1/2    sqrt(3)/2     -2      ]
[    0         0          1      ]


2.

L = { p + tu | t in R }
T(x) = Mx + w

T(L) = { (Mp + w) + t(Mu) | t in R }

I was hoping to see this written in this form emphasizing that it still is
point + t * vector, but I also accepted other equivalent expressions.


3.
{ M [cos(t) sin(t) 1]^T | t in [0, 2pi] }

where

    [1 0 6] [sqrt(2)/2 -sqrt(2)/2 0] [3*sqrt(2)    0    0]
M = [0 1 4] [sqrt(2)/2  sqrt(2)/2 0] [    0     sqrt(2) 0]
    [0 0 1] [    0          0     1] [    0        0    1]