1. 2D Transformations (Matrix Representation) Translation Point $P(x, y)$ translated by $(t_x, t_y)$ to $P'(x', y')$. Matrix form: $$ P' = P + T \implies \begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} x \\ y \end{pmatrix} + \begin{pmatrix} t_x \\ t_y \end{pmatrix} $$ Scaling Point $P(x, y)$ scaled by $(s_x, s_y)$ relative to origin to $P'(x', y')$. Matrix form: $$ \begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} s_x & 0 \\ 0 & s_y \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} $$ Rotation Point $P(x, y)$ rotated by angle $\theta$ about origin to $P'(x', y')$. Matrix form: $$ \begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} $$ 2. Homogeneous Coordinates in 2D Allows all transformations (translation, scaling, rotation) to be represented as matrix multiplications. A 2D point $(x, y)$ is represented as $(x, y, 1)$ in homogeneous coordinates. Translation Matrix: $$ T(t_x, t_y) = \begin{pmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{pmatrix} $$ Scaling Matrix: $$ S(s_x, s_y) = \begin{pmatrix} s_x & 0 & 0 \\ 0 & s_y & 0 \\ 0 & 0 & 1 \end{pmatrix} $$ Rotation Matrix: $$ R(\theta) = \begin{pmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{pmatrix} $$ 3. 2D Rotation about an Arbitrary Point To rotate a point $P$ by angle $\theta$ about an arbitrary point $P_f(x_f, y_f)$: Translate $P_f$ to the origin: $T(-x_f, -y_f)$. Rotate about the origin by $\theta$: $R(\theta)$. Translate $P_f$ back to its original position: $T(x_f, y_f)$. Composite Transformation Matrix: $M = T(x_f, y_f) \cdot R(\theta) \cdot T(-x_f, -y_f)$ $$ M = \begin{pmatrix} 1 & 0 & x_f \\ 0 & 1 & y_f \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & -x_f \\ 0 & 1 & -y_f \\ 0 & 0 & 1 \end{pmatrix} $$ $$ M = \begin{pmatrix} \cos\theta & -\sin\theta & x_f(1-\cos\theta)+y_f\sin\theta \\ \sin\theta & \cos\theta & y_f(1-\cos\theta)-x_f\sin\theta \\ 0 & 0 & 1 \end{pmatrix} $$ 4. 3D Translation and Scaling (Matrix Form) Using homogeneous coordinates for 3D, a point $(x, y, z)$ is represented as $(x, y, z, 1)$. Translation: Point $P(x, y, z)$ translated by $(t_x, t_y, t_z)$. $$ T(t_x, t_y, t_z) = \begin{pmatrix} 1 & 0 & 0 & t_x \\ 0 & 1 & 0 & t_y \\ 0 & 0 & 1 & t_z \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ Scaling: Point $P(x, y, z)$ scaled by $(s_x, s_y, s_z)$ relative to origin. $$ S(s_x, s_y, s_z) = \begin{pmatrix} s_x & 0 & 0 & 0 \\ 0 & s_y & 0 & 0 \\ 0 & 0 & s_z & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ 5. 3D Rotation about X, Y, and Z Axes Rotation about X-axis ($R_x(\theta)$): $$ R_x(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta & 0 \\ 0 & \sin\theta & \cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ Rotation about Y-axis ($R_y(\theta)$): $$ R_y(\theta) = \begin{pmatrix} \cos\theta & 0 & \sin\theta & 0 \\ 0 & 1 & 0 & 0 \\ -\sin\theta & 0 & \cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ Rotation about Z-axis ($R_z(\theta)$): $$ R_z(\theta) = \begin{pmatrix} \cos\theta & -\sin\theta & 0 & 0 \\ \sin\theta & \cos\theta & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ 6. 2D vs. 3D Transformations Feature 2D Transformations 3D Transformations Dimensions Operate on 2D points $(x, y)$. Operate on 3D points $(x, y, z)$. Homogeneous Coords $(x, y, 1)$ for 2D points. $(x, y, z, 1)$ for 3D points. Matrix Size $3 \times 3$ matrices. $4 \times 4$ matrices. Rotation Axes Only about a point (effectively Z-axis in 2D plane). About X, Y, Z axes, or arbitrary axis. Complexity Simpler, fewer degrees of freedom. More complex, higher degrees of freedom. 7. Rotation about an Arbitrary Axis in 3D To rotate an object about an arbitrary axis defined by two points $P_1(x_1, y_1, z_1)$ and $P_2(x_2, y_2, z_2)$ by angle $\theta$: Translate $P_1$ to the origin: $T(-x_1, -y_1, -z_1)$. Align the rotation axis with one of the coordinate axes (e.g., Z-axis) using two rotations ($R_x, R_y$). Perform the desired rotation $\theta$ about the aligned axis ($R_z(\theta)$). Undo the alignment rotations ($R_y^{-1}, R_x^{-1}$). Undo the initial translation ($T(x_1, y_1, z_1)$). The overall transformation matrix $M = T^{-1} \cdot R_x^{-1} \cdot R_y^{-1} \cdot R_z(\theta) \cdot R_y \cdot R_x \cdot T$. The rotation axis vector $\vec{V} = P_2 - P_1 = (a, b, c)$. Normalized vector $\vec{u} = (a', b', c')$, where $a' = a/|\vec{V}|$, etc. Rotation angles to align with Z-axis: Rotate about X-axis by $\alpha_x$: $R_x(\alpha_x)$ to bring $\vec{V}$ into XZ-plane. $\cos \alpha_x = c'/d$, $\sin \alpha_x = b'/d$, where $d = \sqrt{b'^2+c'^2}$. Rotate about Y-axis by $\alpha_y$: $R_y(\alpha_y)$ to align with Z-axis. $\cos \alpha_y = d$, $\sin \alpha_y = a'$. 8. Composite Transformations in 3D A sequence of transformations can be combined into a single composite transformation matrix by multiplying the individual transformation matrices in reverse order of application. If transformations $M_1, M_2, \dots, M_n$ are applied sequentially to a point $P$, the final transformed point $P'$ is given by: $$ P' = (M_n \cdot \dots \cdot M_2 \cdot M_1) \cdot P $$ Matrix multiplication is not commutative, so the order of transformations is crucial. Example: Scaling about an arbitrary point $P_f$ in 3D: Translate $P_f$ to origin: $T(-x_f, -y_f, -z_f)$. Scale: $S(s_x, s_y, s_z)$. Translate back: $T(x_f, y_f, z_f)$. Composite matrix $M = T(x_f, y_f, z_f) \cdot S(s_x, s_y, s_z) \cdot T(-x_f, -y_f, -z_f)$. 9. Parallel Projections Projectors are parallel to each other and perpendicular or oblique to the projection plane. Preserves relative proportions of objects. Orthographic Projections Projectors are parallel to each other and perpendicular to the projection plane. Used for engineering drawings and architectural blueprints where accurate measurements are critical. Types: Multiview: Displays different sides (front, top, side views). Axonometric: Shows multiple faces, but without perspective foreshortening. Isometric: All three axes are equally foreshortened; angles between projected axes are $120^\circ$. Dimetric: Two axes equally foreshortened. Trimetric: All three axes unequally foreshortened. Projection Matrix (onto XY plane): $$ P_{ortho} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ Oblique Projections Projectors are parallel to each other but not perpendicular to the projection plane. Shows more of the object's depth than orthographic views. Types: Cavalier: Depth measurements along the receding axis are full scale. Cabinet: Depth measurements along the receding axis are reduced by half. Projection Matrix (onto XY plane, angle $\phi$ with positive z-axis, $\alpha$ with x-axis in XY plane): $$ P_{oblique} = \begin{pmatrix} 1 & 0 & L \cos\alpha & 0 \\ 0 & 1 & L \sin\alpha & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} $$ where $L = \cot\phi$. For Cavalier, $L=1$; for Cabinet, $L=0.5$. 10. Parallel vs. Perspective Projections Feature Parallel Projection Perspective Projection Projectors Parallel to each other. Converge to a single point (center of projection). Distance Objects appear the same size regardless of distance. Objects appear smaller as their distance from the viewer increases (foreshortening). Realism Less realistic, but good for precise measurements. More realistic, mimics human vision. Vanishing Points No vanishing points. Contains one, two, or three vanishing points. Applications Engineering, architecture (multiviews). Art, photography, computer graphics (realistic scenes). Parallel Lines Remain parallel in projection. Non-parallel lines converge to vanishing points.