UNIT 3
Two-Dimensional Geometric Transformations
In Computer Graphics, a transformation is a way of changing the position, size, or
orientation of an object in a 2D plane.
Each point of an object is represented as coordinates (x, y), and transformations
modify these coordinates.
There are different types:
Translation – moving an object from one place to another.
Scaling – resizing an object (making it bigger or smaller).
Rotation – rotating an object around a point.
Reflection – flipping an object.
Shearing – slanting an object
Foundation of Computer Graphics
Every shape, picture, or object on a screen is made up of points (x, y).
To move, resize, rotate, or manipulate these shapes, we use transformations.
Animation & Games
Characters, cars, or objects in games move using translation.
They grow, shrink, or zoom in/out using scaling.
Example: Mario running → translation; Zoom in a racing game → scaling.
Image Processing
Zooming in/out of images = scaling.
Cropping and moving parts of an image = translation.
[Link]
Definition:
Translation means moving an object from one location to another without changing
its shape, size, or orientation.
Formula:
If a point P(x, y) is translated by distances Tx along the X-axis and Ty along the Y-
axis, the new point P’(x’, y’) is:
x′=x+Tx
y′=y+Ty
Original point: (2, 3)
Translation: (Tx = 4, Ty = 5)
New point: (2+4, 3+5) = (6, 8)
[Link]
Definition:
Scaling means resizing an object (enlarging or shrinking).
Formula:
If a point P(x, y) is scaled by factors Sx along X-axis and Sy along Y-
axis, the new point P’(x’, y’) is:
x′= x⋅Sx
y' = [Link]
In this process, Sx and Sy are the scaling factors for the x and y directions,
respectively.
Meaning of Sx and Sy in Scaling:
Sx → Scaling factor along the x-axis
Sy → Scaling factor along the y-axis
They determine how much the object is stretched or shrunk in each direction.
Original point: (3, 2)
Scaling: (Sx = 2, Sy = 3)
New point: (3×2, 2×3) = (6, 6)
If Sx > 1 → Object expands horizontally
If Sx < 1 → Object shrinks horizontally
If Sy > 1 → Object expands vertically
If Sy < 1 → Object shrinks vertically
Algorithm:
1. Make a 2x2 scaling matrix S as:
Sx 0
0 Sy
2. For each point of the polygon.
(i) Make a 2x1 matrix P, where P[0][0] equals
to x coordinate of the point and P[1][0]
equals to y coordinate of the point.
(ii) Multiply scaling matrix S with point
matrix P to get the new coordinate.
3. Draw the polygon using new coordinates.
3. ROTATION
Rotation is a transformation that turns (or rotates) an object around a fixed point
(usually the origin) by a specified angle θ.
It changes the orientation of the object but does not change its shape or size.
Mathematical Representation:
If a point P(x,y) is rotated by an angle θ (anti-clockwise direction) about the origin,
the new coordinates P′(x′,y′) are:
x′=xcosθ−ysinθ
y′=xsinθ+ycosθ
Example:
Original point: P(2,0)
Rotate by 90∘ counter clockwise
We know:
cos90∘=0
sin90∘=1
x′=2×0−0×1=0
y′=2×1+0×0=2
New point: P′(0,2)
4. Reflection:
Reflection is a transformation that produces a mirror image of an object with respect to a
given line called the axis of reflection.
It reverses the orientation of the object but keeps its shape and size unchanged.
Reflection is the mirror image of original object. In other words, we can say that it is a
rotation operation with 180°. In reflection transformation, the size of the object does not
change.
The following figures show reflections with respect to X and Y axes, and about the origin
respectively.
5. Shear
A transformation that slants the shape of an object is called the shear transformation. There
are two shear transformations X-Shear and Y-Shear. One shifts X coordinates values and
other shifts Y coordinate values. However; in both the cases only one coordinate changes its
coordinates and other preserves its values. Shearing is also termed as Skewing.
X-Shear
The X-Shear preserves the Y coordinate and changes are made to X coordinates, which
causes the vertical lines to tilt right or left as shown in below figure.
Y-Shear
The Y-Shear preserves the X coordinates and changes the Y coordinates which causes the
horizontal lines to transform into lines which slopes up or down as shown in the following
figure.
Matrix Representation of Transformations
Matrix representation provides a compact, mathematical way to apply transformations.
Each 2D transformation can be written as a matrix multiplication.
This is useful in computer graphics, because computers handle matrices efficiently.
Examples:
Translation:
X’= 1 0 TX X
Y’= 0 1 TY Y
1= 0 01 1
Scaling:
X’= SX 0 0 X
Y’= 0 SY 0 Y
1= 0 01 1
3. Homogeneous Coordinates:
Homogeneous coordinates are a way to represent 2D points in 3 coordinates instead of 2:
(x,y)→(x,y,1)
The extra coordinate (usually 1) allows all transformations (translation, scaling,
rotation, shear) to be expressed uniformly using matrix multiplication.
Without homogeneous coordinates, translation cannot be represented as a matrix
multiplication.
Benefits:
1. Simplifies combination of multiple transformations into a single matrix.
Example: Translate → Rotate → Scale → can be done by multiplying their matrices.
2. Makes computer graphics calculations efficient and consistent.
How it works:
Original 2D point: P(x , y)
Convert to homogeneous coordinate: Ph=(x , y , 1)
Apply transformation matrix:
'
Ph=T ⋅ Ph
Result: (x ' , y ' ,1)→ convert back to normal 2D coordinates: (x ' , y ' )
3. Example: Translation Using Homogeneous Coordinates
Original point: (2 , 3)
Translation: T x =4 , T y =5
Matrix form:
1 0 4 2 = 6
0 1 5 3 = 8
0 0 1 1 = 1
COMPOSITE TRANSFORMS
Definition:
A composite transformation is formed when two or more transformations (like translation,
rotation, scaling, shear, or reflection) are combined into a single matrix.
Instead of applying each transformation separately, they are merged (composed) using matrix
multiplication so they can be applied in one step.
Purpose:
To perform multiple geometric transformations efficiently.
To simplify computation (especially in computer graphics, animation, and CAD).
To maintain transformation order — since transformations are not commutative.
Mathematical Representation:
If we apply transformations:
1. Scaling → S
2. Rotation → R
3. Translation → T
Then the composite transformation matrix is:
M=T×R×S
And to transform a point P:
'
P =M × PNote: The order of multiplication matters.
The rightmost matrix is applied first.
Matrix multiplication is not commutative: T × R ≠ R ×T .
Example:
Suppose we have a point P(1 , 1)and we perform:
1. Scaling: S x =2 , S y =3
2. Translation: T x =4 , T y =5
Step 1: Write matrices
Scaling matrix:
2 0 0
S=[ 0 3 0 ]Translation matrix:
0 0 1
1 0 4
T =[ 0 1 5 ]Step 2: Combine them (Scaling → then Translation)
0 0 1
2 0 4
M =T × S=[ 0 3 5 ]Step 3: Apply to point
0 0 1
1 6
'
P =M ×[ 1 ]=[ 8 ]
1 1
Result: P' (6 , 8)
Advantages of Composite Transformations
1. Efficiency in Computation
Instead of applying each transformation (translation, rotation, scaling, etc.) one by
one, we combine all transformations into a single matrix.
This reduces the number of matrix multiplications and saves computation time.
Example:
Instead of doing
Translate → Rotate → Scale separately,
we create one combined matrix and apply it once to all points.
2. Simplified Representation
All transformations can be represented using a single matrix.
This makes it easier to store, modify, or reuse the transformation in programs or
graphics systems.
Example:
A single 3×3 homogeneous matrix can represent translation, rotation, and scaling together.
3. Easy to Apply to Multiple Points
Once a composite transformation matrix is created, it can be applied to many objects
or points efficiently.
No need to repeat the transformation steps for each object.
Used in:
Animation, 3D modeling, and simulation where many points (vertices) move together.
4. Preserves Order and Accuracy
Using matrix multiplication keeps the exact order of transformations.
Prevents rounding errors that could occur when applying multiple transformations
separately.
Note: Transformation order matters —
for example, scaling before translation ≠ translation before scaling.
5. Easier to Invert or Reverse
A composite matrix can be inverted to reverse all transformations in one step.
This is useful when you need to go from one coordinate system back to another (e.g.,
from camera view back to world coordinates).
Example:
To undo a rotation and translation, simply use the inverse of the composite matrix.
Types of Combination Orders in Composite Transformations
When we combine multiple transformations (like translation, rotation, scaling, etc.),
the order in which we multiply the matrices affects the final result.
This concept is known as Combination Order.
Two Main Types of Combination Orders
1. Post-Multiplication (Right-to-Left Order)
Description:
The transformations are multiplied to the right of the coordinate vector.
The rightmost transformation is applied first.
Formula:
'
P =T × R ×S × P
Here:
P= Original point (in homogeneous coordinates)
S= Scaling matrix
R = Rotation matrix
T = Translation matrix
P = Transformed point
'
Order of application:
1. Apply Scaling (S)
2. Then Rotation (R)
3. Finally Translation (T)
Used in:
Transforming individual objects or points.
Computer graphics (OpenGL, CAD) generally use this convention.
Example:
M =T × R × S
When applied to P, it means:
1. Scale the point.
2. Rotate it.
3. Move (translate) it to new position.
2. Pre-Multiplication (Left-to-Right Order)
Description:
The transformations are multiplied to the left of the coordinate vector.
The leftmost transformation is applied first.
Formula:
'
P =P × S × R ×T
Order of application:
1. Translation (T)
2. Rotation (R)
3. Scaling (S)
Used in:
Changing coordinate systems (reference frames).
Common in robotics, camera transformations, and view coordinate systems.
Transformations Between Coordinate Systems
Definition
In computer graphics, robotics, or CAD, objects and scenes are described using different
coordinate systems (frames of reference).
A transformation between coordinate systems is a mathematical process that converts
coordinates of points or objects from one coordinate system to another using transformation
matrices.
Why We Need It
When you design or render an object:
Each object has its own local (model) coordinates.
The world defines where all objects exist together.
The camera (view) defines what part of the world is seen.
The screen displays the final image.
To display a 3D scene correctly, we must convert (transform) coordinates between these
systems step-by-step.
Main Coordinate Systems
Coordinate System Description
Model (Local) Coordinate Defines the shape and size of the object relative to itself (origin
System usually at object’s center).
World Coordinate System Defines where each object is placed in the overall scene.
View (Camera) Coordinate Defines how the scene looks from the camera’s position and
System orientation.
Screen (Device) Coordinate Defines how the final image is drawn on the screen or output
System device.