index.md (1616B)
1 +++ 2 title = 'Applications to computer graphics' 3 template = 'page-math.html' 4 +++ 5 6 # Applications to computer graphics 7 graphics are stored in a matrix, such as this: 8 9   10 11 ## Homogeneous coordinates 12 ### 2D 13 each point (x, y) in 2D can be identified with point (x, y, 1) in 3D. so we say that (x, y) has homogeneous coordinates (x, y, 1). 14 15 e.g. translation is not a linear transformation. but $(x, y) \mapsto (x+h, y+k)$ can be written in homogeneous coordinates as $(x, y, 1) \mapsto (x+h, y+k, 1)$, and can be computed using matrix multiplication: 16 17 $\begin{bmatrix} 1 & 0 & h\\\\ 0 & 1 & k\\\\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} x \\\\ y \\\\ 1 \end{bmatrix} = \begin{bmatrix} x+h \\\\ y+k \\\\ 1 \end{bmatrix}$ 18 19 ### 3D 20 (X, Y, Z, H) are homogeneous coordinates for (x, y, z) if H ≠ 0 and 21 22 $x = \frac{X}{H}, \quad y = \frac{Y}{H}, \quad \text{and} \\; z = \frac{Z}{H}$ 23 24 ## Matrices for typical transformations 25  26 27 ## Composite transformations 28 when you need two or more basic transformations, such a composite transformation is a matrix multiplication. 29 30 matrices for new transformations are "prepended" in multiplication. so if you're rotating, then translating, the calculation is `[matrix for translation][matrix for rotation]`. 31 32 ## Perspective projections 33 maps each point (x, y, z) onto an image point (x*, y*, 0) so that two points and eye position (center of projection) are on a line. 34 35  36