Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

2.6 Composition of 2D Transformations

Lesson 15 of 32 in the free Computer Graphics notes on Siksha Sarovar, written by Rohit Jangra.

Order Matters

Matrix multiplication is associative but not commutative in general. Translating then rotating is different from rotating then translating.

Composition Rule (column-vector convention)

If a point is transformed first by A, then by B, then by C, the combined matrix is M = C B A. Read right to left: closest to P is applied first.

Common Composite: Rotate about Arbitrary Pivot (px, py)

M = T(px,py) R(theta) T(-px,-py). Walk through:

  1. Translate so pivot moves to origin.
  2. Rotate.
  3. Translate back so pivot returns to (px, py).

Common Composite: Scale about Arbitrary Pivot

M = T(px,py) S(sx,sy) T(-px,-py).

Common Composite: Reflect Across Arbitrary Line ax+by+c=0

  1. Translate so line passes through origin.
  2. Rotate so line aligns with X-axis.
  3. Reflect across X-axis.
  4. Inverse rotate.
  5. Inverse translate.

Numerical Example

Rotate point (5, 0) by 90 deg about pivot (2, 0): M = T(2,0) R(90) T(-2,0).

  • T(-2,0): (5,0) -> (3,0).
  • R(90): (3,0) -> (0,3).
  • T(2,0): (0,3) -> (2,3). Final answer: (2, 3).

If we naively rotated first then translated: R(90)(5,0)=(0,5); T(2,0)(0,5)=(2,5). Different result -> shows non-commutativity.

Why Compose at All

Composing into one matrix means each vertex is transformed by one 3x3 (or 4x4) multiplication regardless of how many logical operations you wanted. For modeling hierarchies (a hand attached to an arm attached to a torso), each child concatenates its local matrix with its parent's, producing a single world-space matrix per object.

Inverse and Identity

  • Identity I leaves points unchanged; M * I = M.
  • Inverse undoes a transform; useful for converting between coordinate systems.
  • Inverses: T^-1(tx,ty) = T(-tx,-ty); R^-1(theta) = R(-theta); S^-1(sx,sy) = S(1/sx, 1/sy) (sx, sy != 0).