Study guide
2D Geometric Transformation in Computer Graphics: Matrices and a Solved Numerical
2D geometric transformation for TU CSIT Computer Graphics (CSC214) and BIT304: translation, rotation, scaling, reflection, shear, homogeneous 3 x 3 matrices, composite order and a worked triangle rotation about a pivot.
2026-10-24 | notesharu team
"Explain 2D geometric transformation in computer graphics" is a standard long question in TU BSc CSIT Computer Graphics (CSC214), unit 3 "Two-Dimensional Geometric Transformations", and in BIT Computer Graphics (BIT304), unit 4 "2D Geometric Transformations". It is usually asked as a derivation of one or more matrices followed by a numerical on a triangle or a rectangle.
This guide covers the 2d geometric transformation set in the order the syllabus lists it: translation, rotation, scaling, reflection and shear, then homogeneous coordinates (why the matrices are 3 x 3), composite transformations and the matrix order, and one fully worked numerical that rotates a triangle about a pivot. The unit notes are on the CSC214 Two-Dimensional Geometric Transformations notes page and the BIT304 2D Geometric Transformations notes page.
What a geometric transformation does
A geometric transformation changes the position, size or orientation of an object by changing the coordinates of its points. Because a line stays a line under all the transformations below, it is enough to transform the end points (or the vertices of a polygon) and then redraw the lines between them.
A point $P(x, y)$ is written as a column vector and the transformed point $P'(x', y')$ is obtained as $P' = M \cdot P$ (or $P' = P + T$ for translation in the plain 2 x 2 form).
Basic transformations
Translation
Translation moves every point by the same distance $t_x$ along x and $t_y$ along y, with no change of shape or size.
$$x' = x + t_x, \qquad y' = y + t_y$$
Rotation about the origin
Rotation turns a point through an angle $\theta$ about the origin, anticlockwise for a positive angle. Writing the point in polar form $x = r\cos\phi$, $y = r\sin\phi$ and expanding $x' = r\cos(\phi + \theta)$, $y' = r\sin(\phi + \theta)$ gives
$$x' = x\cos\theta - y\sin\theta$$
$$y' = x\sin\theta + y\cos\theta$$
For a clockwise rotation replace $\theta$ by $-\theta$.
Scaling about the origin
Scaling multiplies the coordinates by factors $s_x$ and $s_y$.
$$x' = x \cdot s_x, \qquad y' = y \cdot s_y$$
If $s_x = s_y$ the scaling is uniform and the shape is preserved; otherwise it is differential and the shape is distorted. A factor above 1 enlarges the object and moves it away from the origin, and a factor below 1 shrinks it and moves it towards the origin.
Reflection
Reflection produces a mirror image. About the x axis a point becomes $(x, -y)$, about the y axis it becomes $(-x, y)$, about the origin it becomes $(-x, -y)$, and about the line $y = x$ the coordinates are swapped to $(y, x)$.
Shear
Shear slants the object. An x-direction shear with factor $sh_x$ gives $x' = x + sh_x \cdot y$ and $y' = y$; a y-direction shear with factor $sh_y$ gives $x' = x$ and $y' = y + sh_y \cdot x$.
Homogeneous coordinates: why 3 x 3 matrices
Rotation, scaling, reflection and shear are all matrix multiplications, but translation is an addition. That mismatch means a sequence of mixed transformations cannot be folded into one matrix. The fix is to represent a point as $(x, y, 1)$, a homogeneous coordinate with a third component $w = 1$. With this representation every basic transformation becomes a 3 x 3 matrix multiplication, so any sequence of them can be combined by multiplying the matrices into a single composite matrix.
$$T(t_x, t_y) = \begin{bmatrix} 1 & 0 & t_x \ 0 & 1 & t_y \ 0 & 0 & 1 \end{bmatrix}$$
$$R(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \ \sin\theta & \cos\theta & 0 \ 0 & 0 & 1 \end{bmatrix}$$
$$S(s_x, s_y) = \begin{bmatrix} s_x & 0 & 0 \ 0 & s_y & 0 \ 0 & 0 & 1 \end{bmatrix}$$
The reflection matrix about the x axis is $\mathrm{diag}(1, -1, 1)$, about the y axis it is $\mathrm{diag}(-1, 1, 1)$, and the shear matrices put $sh_x$ in row 1, column 2 (or $sh_y$ in row 2, column 1) of the identity.
Composite transformations and matrix order
A composite transformation is a sequence of basic ones combined into one matrix. With column vectors the matrix of the transformation applied first sits closest to the point, so the sequence "first $M_1$, then $M_2$, then $M_3$" is written
$$M = M_3 \cdot M_2 \cdot M_1$$
Matrix multiplication is not commutative, so changing the order changes the result. For example, translating and then rotating is not the same as rotating and then translating. State the order explicitly in the exam.
Rotation about an arbitrary pivot $(x_p, y_p)$
Rotation matrices work about the origin, so for any other pivot the pivot is first moved to the origin, the rotation is done, and the pivot is moved back.
$$R_{pivot} = T(x_p, y_p) \cdot R(\theta) \cdot T(-x_p, -y_p)$$
Scaling about a fixed point $(x_f, y_f)$
The same idea applies: translate the fixed point to the origin, scale, translate back.
$$S_{fixed} = T(x_f, y_f) \cdot S(s_x, s_y) \cdot T(-x_f, -y_f)$$
Multiplying out gives $x' = x s_x + x_f(1 - s_x)$ and $y' = y s_y + y_f(1 - s_y)$, which is a handy check on your matrix.
Worked numerical: rotate a triangle about a pivot
Question. Rotate the triangle $A(2, 2)$, $B(5, 2)$, $C(3, 4)$ through $90^\circ$ anticlockwise about the pivot $(1, 1)$.
The pivot is not the origin, so the composite form $T(1,1) \cdot R(90^\circ) \cdot T(-1,-1)$ is used. For $\theta = 90^\circ$ we have $\cos\theta = 0$ and $\sin\theta = 1$.
First the three matrices:
$$T(-1,-1) = \begin{bmatrix} 1 & 0 & -1 \ 0 & 1 & -1 \ 0 & 0 & 1 \end{bmatrix}$$
$$R(90^\circ) = \begin{bmatrix} 0 & -1 & 0 \ 1 & 0 & 0 \ 0 & 0 & 1 \end{bmatrix}$$
$$T(1,1) = \begin{bmatrix} 1 & 0 & 1 \ 0 & 1 & 1 \ 0 & 0 & 1 \end{bmatrix}$$
Multiplying the rotation by the first translation gives
$$R(90^\circ) \cdot T(-1,-1) = \begin{bmatrix} 0 & -1 & 1 \ 1 & 0 & -1 \ 0 & 0 & 1 \end{bmatrix}$$
and pre-multiplying by $T(1,1)$ gives the composite matrix
$$M = \begin{bmatrix} 0 & -1 & 2 \ 1 & 0 & 0 \ 0 & 0 & 1 \end{bmatrix}$$
so that $x' = -y + 2$ and $y' = x$. Apply $M$ to the vertices written as homogeneous columns:
$$M \begin{bmatrix} 2 \ 2 \ 1 \end{bmatrix} = \begin{bmatrix} -2 + 2 \ 2 \ 1 \end{bmatrix} = \begin{bmatrix} 0 \ 2 \ 1 \end{bmatrix}$$
$$M \begin{bmatrix} 5 \ 2 \ 1 \end{bmatrix} = \begin{bmatrix} -2 + 2 \ 5 \ 1 \end{bmatrix} = \begin{bmatrix} 0 \ 5 \ 1 \end{bmatrix}$$
$$M \begin{bmatrix} 3 \ 4 \ 1 \end{bmatrix} = \begin{bmatrix} -4 + 2 \ 3 \ 1 \end{bmatrix} = \begin{bmatrix} -2 \ 3 \ 1 \end{bmatrix}$$
Therefore the rotated triangle has vertices $A'(0, 2)$, $B'(0, 5)$ and $C'(-2, 3)$. As a check, the side $AB$ has length 3 and so does $A'B'$, and the pivot $(1,1)$ gives $M \cdot (1,1,1)^T = (1, 1, 1)^T$, so it does not move.
How to write it in the exam
For a theory question, define a geometric transformation, state why homogeneous coordinates are used, and give the equation and 3 x 3 matrix for translation, rotation and scaling, with one line each on reflection and shear. For a composite question, write the order of the product, show the three matrices and multiply them out before touching the points. For a numerical, always list the transformation sequence first, then the composite matrix, then the transformed vertices, and finish with a sentence stating the new coordinates.
Rotation and scaling in three dimensions follow the same pattern with 4 x 4 matrices, covered in the CSC214 three-dimensional transformation notes. The full subject pages are CSC214 Computer Graphics and BIT304 Computer Graphics.
Put it into practice
Browse all subjectsMore articles
Study guide
6 Advantages of Cloud Computing, Availability and Programming Models: Exam Guide
2026-10-24
Study guide
Common Bus System in Computer Architecture with Diagram: Registers, Selection Table, Answer
2026-10-24
Study guide
Exception Handling in C++: try, catch, throw, Rethrow with Traced Examples and new/delete
2026-10-24
Study guide
Data Transfer Instructions in Computer Architecture: Mnemonic Tables, Types and Example
2026-10-24
Study guide
Definition of Constitution by Different Scholars and Government Power Distribution in Nepal 2015
2026-10-24
Study guide
Clocked RS Flip Flop Truth Table and Mod 3, Mod 5 Synchronous Counter Design: Digital Logic
2026-10-24