2D Transformations in Computer
Graphics
Detailed Explanation with Diagrams
and Examples
Introduction
• • 2D Transformation = changing position, size,
shape or orientation of objects in 2D plane.
• • Operations are applied on (x,y) coordinates.
• • Achieved using equations & matrix
representation.
• • Essential for graphics, CAD, gaming,
animations.
Types of 2D Transformations
• 1. Translation (Shifting)
• 2. Scaling (Resizing)
• 3. Rotation (Turning)
• 4. Reflection (Mirroring)
• 5. Shearing (Slanting)
• 6. Composite Transformation
Translation
• • Moves object from one location to another.
• • Formula: x' = x + tx ; y' = y + ty
• • Matrix:
• [1 0 tx]
• [0 1 ty]
• [0 0 1]
Scaling
• • Changes the size of object.
• • Formula: x' = x * sx ; y' = y * sy
• • sx, sy are scale factors.
• • Matrix:
• [sx 0 0]
• [0 sy 0]
• [0 0 1]
Rotation
• • Rotates an object about origin.
• • Formula: x' = x cosθ - y sinθ ; y' = x sinθ + y
cosθ
• • Matrix:
• [cosθ -sinθ 0]
• [sinθ cosθ 0]
• [0 0 1]
Reflection
• • Produces mirror image.
• • About X-axis: (x, -y)
• • About Y-axis: (-x, y)
• • About line y=x: (y, x)
Shearing
• • Slants the object.
• • Formula: x' = x + shx * y ; y' = y + shy * x
• • Matrix:
• [1 shx 0]
• [shy 1 0]
• [0 0 1]
Composite Transformation
• • Combination of multiple transformations.
• • Achieved using matrix multiplication.
• • Example: Rotate → Scale → Translate.
• • Order matters: Rotation then Translation ≠
Translation then Rotation.
Applications
• • Computer Graphics (Games, UI)
• • CAD and Engineering Design
• • Image Processing
• • Robotics & Simulations
• • Animation & Movies