Skip to content

Commit

Permalink
formatting, improve dda
Browse files Browse the repository at this point in the history
  • Loading branch information
err53 committed Oct 25, 2024
1 parent 13e7dab commit 8856b2d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions COMPSCI-3GC3/3gc3-midterm.tex
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ \section{Camera / Viewing Transformations}
Step 1 (left matrix): Translates camera position $e$ to origin $e$. Things originally at $e$ are now at $\vec{0}$.\\
Step 2 (right matrix): Rotates, maps basis vectors: $u \mapsto (1,0,0), v \mapsto (0,1,0), w \mapsto (0,0,1)$

\textbf{3x3 Camera Matrix}
\textbf{3\(\times\)3 Camera Matrix}
\(
M_{cam}
= \begin{bmatrix}
Expand Down Expand Up @@ -530,7 +530,10 @@ \section{Rasterization}
Implicit line function: $f(x,y): Ax + By + C = 0$. Checking sign of $f(x_P, y_P)$ can determine point position relative to line.\\

\textbf{Naive Implementation:} Use the function $y=mx+c$ and iterate $x$ from $x_0$ to $x_1$. No vertical lines!\\
\textbf{Digital Difference Analyser DDA:} Similar, but move in the axis that is shallower.
\textbf{Digital Difference Analyser DDA:}
Precomputes step size for both Y and X from line function.
Marches in direction based on which value changes slower:
if y changes slower march in the x direction and vice versa.

% \includegraphics[width=\linewidth]{rasterize-dda.png}
\begin{lstlisting}
Expand Down Expand Up @@ -601,7 +604,7 @@ \section{Rasterization}
\textbf{Bresenham Algorithm:}

% \includegraphics[width=\linewidth]{rasterize-bresen.png}\\
\begin{lstlisting}
\begin{lstlisting}
drawBresenham(x0, y0, x1, y1):
deltaX = x1-x0
deltaY = y1-y0
Expand Down

0 comments on commit 8856b2d

Please sign in to comment.