\documentstyle{article}[12pt,a4]

\title{Graphics Supervision Work 3\\http://www.matthew.ath.cx/notes/}
\author{Matthew Johnson\\Trinity Hall\\mjj29-notes@srcf.ucam.org}

\begin{document}
\maketitle
\setcounter{secnumdepth}{-2}

\section{3}
\subsection{P}
\subsubsection{6}

BSP tree of: $(0,0)\rightarrow(2,2),(3,4)\rightarrow(1,3),(1,0)\rightarrow(-3,1),(0,3)\rightarrow(3,3),(2,0)\rightarrow(2,1)$.


Numbering them 1 - 5 left to right, and picking 1 first, we have 2,3 and 4 on one side, and 5 on the other. Out of 2,3,4, we pick 4 first, and that has 2 on one side, and three on the other. This produces a graph:
\begin{verbatim}
    1
   / \
  4   5
 / \
2   3
\end{verbatim}

\subsection{E}
\subsubsection{5}

$z$-buffer works by storing a grid of pixels, and at each one storing the depth and the colour. You initialise all the depths to the maximum, and whenever you draw a polygon, you keep the depth information for each pixel, and then check before setting the pixel that you only change the colour of pixels that you are drawing a `closer' depth. This algorithm means that you can draw the polygons in any order - you nolonger require sorting them before drawing.

When calculating the depth value of a pixel, you can't just linearly interpolate the $z$ values over $(x,y)$, since the projection calculation for $x$ \& $y$ used $z$. However, it is easy to modify to $\frac 1 z = (1-t) \frac 1 z_1 + (t) \frac 1 z_2$, which gives correct values.

A-buffer is a technique used for anti-aliasing. We divide up the pixels into 3 types. Those completely within the polygon, those completely without, and those with a boundry. We then store a mask of bits corresponding to a higher resolution grid over the pixel. Those bits indicate which sub-pixels are covered by a polygon. We repeat this for all polygons that cover the pixel, and then perform bitwise operations on them to calculate what percentage of the pixel is covered by which colour. We can then average the colours over the whole pixel to get the anti-aliased colour.

\subsubsection{8}

Transform from a cone of height 1, apex at the origin, and base of diameter 1. Transform to apex $(-1,3,7)$, base center at $(2,7,-5)$, and radius 4.

Transformations needed: base diameter from 1 to 8, height from 1 to $\sqrt([2+1]^2 + [7-3]^2 + [-5-7]^2) = \sqrt(3^2 + 4^2 + 13^2)$.

I can't easily see what transformations are required, even when drawing it out on paper. Is this a question we are likely to get? Also, I'm afraid these are really the only things we've covered, although we have a lecture tomorrow before the supervision.

\end{document}
