diff --git a/exam-2/.gitignore b/exam-2/.gitignore new file mode 100644 index 000000000..4216f66 --- /dev/null +++ b/exam-2/.gitignore @@ -0,0 +1 @@ +exam2.pdf diff --git a/exam-2/Makefile b/exam-2/Makefile new file mode 100644 index 000000000..a3ccf5f --- /dev/null +++ b/exam-2/Makefile @@ -0,0 +1,4 @@ +PANDOC := pandoc + +exam2.pdf: exam2.md + $(PANDOC) -o $@ $< diff --git a/exam-2/exam2-takehome.pdf b/exam-2/exam2-takehome.pdf new file mode 100644 index 000000000..d98ab91 Binary files /dev/null and b/exam-2/exam2-takehome.pdf differ diff --git a/exam-2/exam2.md b/exam-2/exam2.md new file mode 100644 index 000000000..1053f55 --- /dev/null +++ b/exam-2/exam2.md @@ -0,0 +1,93 @@ +--- +geometry: margin=2cm +output: pdf_document +title: Exam 2 +subtitle: CSCI 5607 +date: \today + +author: | + | Michael Zhang + | zhan4854@umn.edu $\cdot$ ID: 5289259 +--- + +\renewcommand{\c}[1]{\textcolor{gray}{#1}} + +## Reflection and Refraction + +1. Consider a sphere $S$ made of solid glass ($\eta$ = 1.5) that has radius $r = + 3$ and is centered at the location $s = (2, 2, 10)$ in a vaccum ($\eta = + 1.0$). If a ray emanating from the point $e = (0, 0, 0)$ intersects $S$ at a + point $p = (1, 4, 8)$: + + a. (2 points) What is the angle of incidence $\theta_i$ ? + + First, the normal at the point $(1, 4, 8)$ is determined by subtracting + that point from the center $(2, 2, 10)$, which gets us $N = (2 - 1, 2 - 4, + 10 - 8) = (1, -2, 2)$. Then, to determine the angle between + + b. (1 points) What is the angle of reflection $\theta_r$ ? + + c. (3 points) What is the direction of the reflected ray? + d. (3 points) What is the angle of transmission $\theta_t$ ? + e. (4 points) What is the direction of the transmitted ray? + + Using Snell's law, we know that $\eta_1 \sin \theta_1 = \eta_2 \sin + \theta_2$. In this case, let material 1 be the vacuum, and material 2 be + the glass. Then, we have $1.0 \times \sin \theta_1$ + +## Geometric Transformations + +2. \c{(8 points) Consider the airplane model below, defined in object + coordinates with its center at $(0, 0, 0)$, its wings aligned with the $\pm + x$ axis, its tail pointing upwards in the $+y$ direction and its nose facing + in the $+z$ direction. Derive a sequence of model transformation matrices + that can be applied to the vertices of the airplane to position it in space + at the location $p = (4, 4, 7)$, with a direction of flight $w = (2, 1, –2)$ + and the wings aligned with the direction $d = (–2, 2, –1)$.} + + The translation matrix is + + $$ + \begin{bmatrix} + 1 & 0 & 0 & x \\ + 0 & 1 & 0 & y \\ + 0 & 0 & 1 & z \\ + 0 & 0 & 0 & 1 \\ + \end{bmatrix} + = + \begin{bmatrix} + 1 & 0 & 0 & 4 \\ + 0 & 1 & 0 & 4 \\ + 0 & 0 & 1 & 7 \\ + 0 & 0 & 0 & 1 \\ + \end{bmatrix} + $$ + + Since the direction of flight was originally $(0, 0, 1)$, we have to + transform it to $(2, 1, -2)$. + +## Clipping + +9. \c{Consider the triangle whose vertex positions, after the viewport + transformation, lie in the centers of the pixels: $p_0 = (3, 3), p_1 = (9, + 5), p_2 = (11, 11)$.} + + Starting at $p_0$, the three vectors are: + + - $v_0 = p_1 - p_0 = (9 - 3, 5 - 3) = (6, 2)$ + - $v_1 = p_2 - p_1 = (11 - 9, 11 - 5) = (2, 6)$ + - $v_2 = p_0 - p_2 = (3 - 11, 3 - 11) = (-8, -8)$ + + The first edge vector $e$ would be $(6, 2)$, and the edge normal would be + that rotated by $90^\circ$. + + a. \c{(6 points) Define the edge equations and tests that would be applied, + during the rasterization process, to each pixel $(x, y)$ within the bounding + rectangle $3 \le x \le 11, 3 \le y \le 11$ to determine if that pixel is + inside the triangle or not.} + + b. \c{(3 points) Consider the three pixels $p_4 = (6, 4), p_5 = (7, 7)$, and + $p_6 = (10, 8)$. Which of these would be considered to lie inside the + triangle, according to the methods taught in class?} + + diff --git a/flake.nix b/flake.nix index 7aaf5ff..fb29e88 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,7 @@ texlive.combined.scheme-full unzip zip + zathura (python310.withPackages (p: with p; [ ipython numpy scipy sympy ])) ]) ++ (with toolchain; [