Chapter-Iii Overview of Transformation
Chapter-Iii Overview of Transformation
CGR-22318
UNIT-III
OVERVIEW OF
TRANSFORMATION
• 2D TRANSFORMATION
• COMPOSITE TRANSFORMATIONS
• 3D TRANSFORMATION
• TYPES OF PROJECTIONS
13-10-2022
INTRODUCTION
• Everyimage or object drawn on a computer needs some
transformations. kindof
13-10-2022
2D
• TRANSFORMATION
2D TRANSFORMATIONS [2 DIMENSIONAL]
• 2D name is given so because it has two axis X and
Y.
Y-axis
The object can
be seen in only
one view
FRONT VIEW
0
X-axis
13-10-2022
2D
•
TRANSFORMATION
TYPES OF 2D TRANSFORMATION
• 1. TRANSLATION
• 2. SCALING
• 3. ROTATION
13-10-2022
2D
•
TRANSFORMATION
1. TRANSLATION [T]
• It is a process of changing the position of object in a straight-
line path from one coordinate location to another
Y-axis
P’ (x’ , y’) x’ = x + tx
ty y’ = y + ty
The translation distance
P
(x , y) tx pair (tx,ty) is called
as
0 translation vector or
13-10-2022
X-axis shift
vector
2D
TRANSFORMATION
• The above translation equations can be represented in single
matrix form.
P’ = P + T
𝑥 𝑥′ 𝑡𝑥
𝑃= 𝑃′ = T=
𝑦 𝑦′ 𝑡𝑦
13-10-2022
2D
•
TRANSFORMATION
Example – Translate a polygon with co-ordinates A(2,5),
B(7,10) and C(10,2) by 3 units in x direction and 4 units in y
direction.
’ ′ 2 3 5
P =P+T 𝐴 =𝐴+𝑇= + =
5 4 9
𝑥
𝑃= 𝐵′ = 𝐵 + 𝑇 =
7
+
3
=
10
𝑦 10 4 14
T = 𝑡𝑥 𝐶′ = 𝐶 + 𝑇 =
10
+
3
=
13
𝑦
13-10-2022
𝑡 2 4 6
2D
• OUTPUT
TRANSFORMATION
Y-axis Y-axis
15 15 B’
B
10 10
A
’ C’
5 A 5
C
X-axis X-axis
0 0
5 10 15 5 10 15
13-10-2022
2D
•
TRANSFORMATION
2. SCALING [S]
• This transformation changes the size of an object.
x’ = x * SX y’ = y * SY
13-10-2022
2D
TRANSFORMATION
• The above scaling equations canbe represented in single
matrix form.
P’ = P x S
𝑥 𝑥′ 𝑆𝑥 0
𝑃= 𝑃′ = 𝑆=
𝑦 𝑦′ 0 𝑆𝑦
13-10-2022
2D
•
TRANSFORMATION
CONDITIONS FOR SCALING
• Any positive numeric values are valid for scaling factors Sx and
Sy
P’ = P x S
𝑥 𝑥′ 2 5 4 10
𝑃= 2
𝑦 𝑃′ = 𝑦
′ 𝐴′ = 𝐴 ∗ 𝑆 = 7 10 =
14 20
0
10 2 20 4
0
𝑆𝑥 0 2
𝑆=
0 𝑆𝑦
13-10-2022
2D
•
TRANSFORMATION
3. ROTATION
• A 2D rotation is applied to an object by repositioning it along
a circular path in the xy plane.
13-10-2022
2D
• TRANSFORMATION
Trigonometric equation for 2D
rotation
𝑥′ = 𝑟𝑐𝑜𝑠 a+ b = 𝑟𝑐𝑜𝑠 a 𝑐𝑜𝑠b − 𝑟𝑠𝑖𝑛 a 𝑠𝑖𝑛 b
𝑦′ = 𝑟𝑠𝑖𝑛 a + b = 𝑟𝑐𝑜𝑠 a 𝑠𝑖𝑛 b + 𝑟𝑠𝑖𝑛 a 𝑐𝑜𝑠 b
𝑃= 𝑥 𝑦 𝑐𝑜𝑠 b 𝑠𝑖𝑛 b
𝑅= CC
−𝑠𝑖𝑛 b 𝑐𝑜𝑠 b
𝑃′ = 𝑥′ 𝑦′
13-10-2022
2D
TRANSFORMATION
• Example – A point (4,3) is rotatedcounterclockwise
by an
angle of 450. Find the rotation matrix and the resultant point.
𝑐𝑜𝑠45° 𝑠𝑖𝑛45° 1/√2 1/√2
P’ = P x R 𝑅= =
−𝑠𝑖𝑛45° 𝑐𝑜𝑠45° −1/√2 1/√2
𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃
𝑅= 1/√2 1/√2
−𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 𝑃′ = 4
−1/√2 1/√2
3
4 3 4 3
= − +
2 2 2 2
= 1/√2 7/√2
13-10-2022
HOMOGENEOUS
• InCOORDINATES
design and picture formation process, many times we may
require to perform translation, scaling and rotation to fit the
picture components into their proper positions.
P’ = P.M1 + M2
13-10-2022
HOMOGENEOUS
•
COORDINATES
FOR TRANSLATION
′1 0 𝑡𝑥
• M1 – Identity Matrix 𝑃=𝑃 +
0 1 𝑡𝑦
• M2 – Translation Matrix
• FOR SCALING
• M1 – Scaling Matrix ′ 𝑆𝑥 0 0
𝑃=𝑃 +
• M2 – 0 0 𝑆𝑦 0
• FOR ROTATION
• M1 – Rotational Matrix 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0
′ +
𝑃=𝑃
• M2 – 0 −𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
13-10-2022
HOMOGENEOUS
• COORDINATES
To produce the transformation by using above equation, we
must calculate transformed coordinates one at a time.
13-10-2022
HOMOGENEOUS
• COORDINATES
For this transformation we have to eliminate matrix addition
in translation terms in M2.
• Therefore we have
1 0 0
𝑥′ 𝑦′ 1 = 𝑥 𝑦 1
0 1 0
𝑡𝑥 𝑡𝑦 1
= 𝑥 + 𝑡𝑥 𝑦 + 𝑡𝑦 1
13-10-2022
HOMOGENEOUS
•
COORDINATES
SCALING
𝑆𝑥 0 0
𝑆= 0 𝑆 0
𝑦
0 0 1
• Therefore we have
𝑆𝑥 0 0
𝑥′ 𝑦′ 1 = 𝑥 𝑦 1 0 𝑆𝑦 0
0 0 1
= 𝑥. 𝑆𝑥 𝑦. 𝑆𝑦 1
13-10-2022
HOMOGENEOUS
•
COORDINATES
ROTATION
𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0
𝑅 = −𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
0 0 1
• Therefore we have
𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0
𝑥′ 𝑦′ 1 = 𝑥 𝑦 1 −𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
0 0 1
13-10-2022
HOMOGENEOUS
COORDINATES
• Example 1 – Give a 3x3homogeneous co-ordinate
transformation matrix for each of the following translations.
13-10-2022
HOMOGENEOUS
COORDINATES
• Homogeneous co-ordinates for translation are
1 0 0
0 1 0
𝑇=
𝑡𝑥 𝑡𝑦 1
1 0 0
𝑇= 0 1 0
• A) Here tx = 3 and ty = 0
3 0 1
• B) Here tx = 0 and ty = 2 1 0 0
𝑇= 0 1 0
13-10-2022 0 2 1
HOMOGENEOUS
COORDINATES
• Homogeneous co-ordinates for translation are
1 0 0
0 1 0
𝑇=
𝑡𝑥 𝑡𝑦 1
1 0 0
𝑇= 0 1 0
• C) Here tx = 1 and ty = -0.5
1 −0.5 1
13-10-2022
HOMOGENEOUS
COORDINATES
• This transformation can be carried out in the following steps.
1. Translate the square so that its center coincides with
the origin.
13-10-2022
HOMOGENEOUS
COORDINATES
1 0 0 0.5 0 0 1 0 0
• T1.S.T = 0 1 0 0 0.5 0 0 1 0
−2 −2 1 0 0 1 2 2 1
0.5 0 0 1 0 0 0.5 0 0
= 0 0.5 0 0 1 0 = 0 0.5 0
−1 −1 1 2 2 1 1 1 1
𝐴′ 1 1 1 1.5 1.5 1
0.5 0 0
𝐵′ = 3 1 1 2.5 1.5 1
0 0.5 0 =
𝐶′ 3 3 1 2.5 2.5 1
0 0 1
𝐷′ 1 3 1 1.5 2.5 1
13-10-2022
HOMOGENEOUS
COORDINATES
• Example 3 – Find the transformation of the triangle A(1,0),
B(0,1), C(1,1) by
a. Rotating angle 45o about the origin and then translating one
unit in x and y direction.
13-10-2022
HOMOGENEOUS
COORDINATES
• The Rotation matrix is
𝑐𝑜𝑠45 𝑠𝑖𝑛45 0 1/√2 1/√2 0
𝑅 = −𝑠𝑖𝑛45 𝑐𝑜𝑠45 0 = −1/√2 1/√2
0 0 1 0
0 0 1
• And the Translation matrix is
1 0 0
𝑇= 0 1 0
1 1 1
13-10-2022
HOMOGENEOUS
COORDINATES
• a)
R.T
1/√2 1/√2 0 1 0 0 1/√2 1/√2 0
𝑅. 𝑇 = −1/√2 1/√2 0 1 0 = −1/√2 1/√2
0 1 1 1 0
0 0 1 1 1 1
𝐴′ 1 0 1 1/√2 0 0 1 1
𝐵′ = 0 1 1 −1/√2 1/√2 2+1 2+1 0
𝐶′ 1 1 1 0 = 1 1
1 1 1 − +21 2+1 0
1 2+1 1
13-10-2022
HOMOGENEOUS
COORDINATES
• a)
T.R
1 0 1 1/√2 1/√2 0 1/√2 1/√2 0
𝑇. 𝑅 = 0 1 0 −1/√2 1/√2 = −1/√2 1/√2
1 1 1 0 0
0 0 1 0 √2 1
𝐴′ 1 0 1 1/√2 0 0 1 3
1
𝐵′ = 0 1 1 −1/√2 1/√2 0 2 2
𝐶′ 1 1 1 1 √2 1 = − 1 3
1
2 2
0 2/√2 1
13-10-2022
2D
•
TRANSFORMATION
4. REFLECTION
• It is a transformation that produce a mirror image of an object
relative to an axis of reflection.
x
0
13-10-2022
y
−1 0 0
0 1 0 Original Object Reflected Object
0 0 1
Reflection about Y-axis x
0
−1 0 0
0 1 0
Original Object
0 0 1
Reflection about X-axis x
0
Reflected Object
13-10-2022
y
−1 0 0
0 −1 0
Original Object
0 0 1
Reflection about origin x
0
Reflected Object
Reflected Object
y
0 1
0
1 0
0 about line x = y
Reflection x
0 Original Object
0 0
1
13-10-2022
y
0 −1 0 Original Object
−1 0 0
0 0 1
Reflection about line y = -x x
0
Reflected Object
13-10-2022
2D
• 5. SHEAR
TRANSFORMATION
• It is a transformation that slants the shape of
an object is called as shear transformation.
13-10-2022
y
x
0
y y
x x
0 Shearing along x axis 0 Shearing along y axis
13-10-2022
2D
• X-SHEAR
TRANSFORMATION
• Values of x coordinate values are changed but y coordinate
values are preserved.
1 0 0
𝑆ℎ𝑥 1 0
0 0 1
13-10-2022
𝑥′ = 𝑥 + 𝑆ℎ𝑥. 𝑦 and 𝑦′ = 𝑦
2D
• Y-SHEAR
TRANSFORMATION
• Values of y coordinate values are changed but x coordinate
values are preserved.
1 𝑆ℎ𝑦 0
0 1 0
0 0 1
′
𝑥 =𝑥
and 𝑦′ = 𝑦 + 𝑆ℎ𝑦. 𝑥
13-10-2022
2D
•
TRANSFORMATION
SHEARING RELATIVE TO OTHER REFERENCE LINE
• We can apply x shear and y shear transformations relative to
other reference lines.
13-10-2022
2D
•
TRANSFORMATION
SHEARING RELATIVE TO OTHER REFERENCE LINE
• The transformation matrices are
1 0 0
x shear with y reference line
𝑆ℎ𝑥 1 0
−𝑆ℎ𝑥. 𝑦𝑟𝑒𝑓 0 1
1 𝑆ℎ𝑦 0
y shear with x reference line
0 1 0
0 −𝑆ℎ𝑦. 𝑥𝑟𝑒𝑓 1
13-10-2022
2D
TRANSFORMATION
• Example – Apply shearing transformation to a square with
A(0,0), B(1,0), C(1,1) and D(0,1) as given below.
13-10-2022
2D
TRANSFORMATION
a) Here Shx = 0.5 and yref = -1
𝐴′ 𝐴
1 0 0
𝐵′ = 𝐵 𝑆ℎ𝑥 1 0
𝐶′ 𝐶 −𝑆ℎ𝑥. 𝑦𝑟𝑒𝑓 0 1
𝐷′ 𝐷
0 0 1 1 0 0 0.5 0 1
= 1 0 1
0.5 1 0 = 1.5 0 1
1 1 1 2 1 1
0 1 1 0.5 0 1 1 1 1
13-10-2022
y y
A(0,0) B(1,0) x x
0 0 A’(0.5,0) B’(1.5,0)
13-10-2022
2D
TRANSFORMATION
b) Here Shy = 0.5 and xref = -1
𝐴′ 𝐴 1 𝑆ℎ 0 𝑦
𝐵′ = 𝐵 0 1 0
𝐶′ 𝐶 0 −𝑆ℎ𝑦. 𝑥𝑟𝑒𝑓 1
𝐷′ 𝐷
0 0 1 0 0.5 1
1 0.5 0
= 1 0 1 1 1 1
0 1 0 =
1 1 1 1 2 1
0 0.5 1
0 1 1 0 1.5 1
13-10-2022
y y
C’(1,2)
D’(0,1.5)
D(0,1) C(1,1)
B’(1,1)
A’(0,0.5)
A(0,0) B(1,0) x x
0 0
13-10-2022
3D
• TRANSFORMATION
3D TRANSFORMATIONS [3 DIMENSIONAL]
• 3D name is given so because it has three axis X, Y & Z.
Y-axis
The object can
be seen in 3
different views
0
Z-axis X-axis
13-10-2022
3D
•
TRANSFORMATION
TYPES OF 3D TRANSFORMATION
• 1. TRANSLATION
• 2. SCALING
• 3. ROTATION
13-10-2022
3D
• TRANSFORMATION
1. TRANSLATION [T]
• It is a process of changing the position of object in a straight-
line path from one coordinate location to another
1 0 0 0
P’ = P x T
T= 0 1 0 0
0 0 1 0
𝑡𝑥 𝑡𝑦 𝑡𝑧 1
1 0 0 0
𝑥′ 𝑦′ 𝑧′ 1 = 𝑥 𝑦 𝑧 1 0 1 0 0
0 0 1 0
𝑡𝑥 𝑡𝑦 𝑡𝑧 1
= 𝑥 + 𝑡𝑥 𝑦 + 𝑡𝑦 𝑧 + 𝑡𝑧 1
3D
• TRANSFORMATION
2. SCALING [S]
• This transformation changes the size of an object.
x’ = x * SX y’ = y * SY z’ = z * Sz
13-10-2022
3D
TRANSFORMATION
• The above scaling equations canbe represented in single
matrix form.
𝑆𝑥 0 0 0
P’ = P x S
S= 0 𝑆𝑦 0 0
0 0 𝑆𝑧 0
0 0 0 1
𝑆𝑥 0 0 0
𝑥′ 𝑦′ 𝑧′ 1 = 𝑥 𝑦 𝑧 1 0 𝑆𝑦 1 0
0 0 𝑆𝑧 0
0 0 0 1
13-10-2022 = 𝑥. 𝑆𝑥 𝑦. 𝑆𝑦 𝑧. 𝑆𝑧 1
3D
• TRANSFORMATION
CONDITIONS FOR SCALING
• Any positive numeric values are valid for scaling factors Sx , Sy
and Sz
• Values less than 1 reduce the size of the object.
• Values greater than 1 enlarge the size of the object.
• For Sx , Sy and Sz if the value is 1 then the size of the object
remains same.
• To get uniform scaling the values of Sx , Sy and Sz should be
equal.
13-10-2022
3D
•
TRANSFORMATION
3. ROTATION
• Three dimensional transformation matrix for each coordinate
axes rotation with homogeneous coordinate are as given
below.
Y-axis
1 0 0 0
Rx = 0 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0
0 −𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
0 0 0 1 0
Z-axis X-axis
13-10-2022
3D
TRANSFORMATION
• The positive value of angle 𝜃 indicates
counterclockwise
rotation. For clockwise rotation value of angle 𝜃 is negative.
Y-axis
1 0 0 0
Rx = 0 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0
0 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
1
0 0 0 0
Z-axis X-axis
13-10-2022
3D
TRANSFORMATION
• Rotation about y axis.
Y-axis
𝑐𝑜𝑠𝜃 0 −𝑠𝑖𝑛𝜃 0 1
Ry = 0 0 0
𝑠𝑖𝑛𝜃 0 𝑐𝑜𝑠𝜃 0 0
1
0 0 0
Z-axis X-axis
13-10-2022
3D
•
TRANSFORMATION
Coordinate-Axes Rotations
– X-axis rotation - P = Rx(θ) . P
– Y-axis rotation - P = Ry(θ) . P
– Z-axis rotation – P = Rz(θ) . P
0 x 0 x 0 x
x' 1 0 0 ⎤⎡ ⎤ x'
⎡ ⎤ ⎡
cosθ 0 sin θ ⎤⎡ ⎤ x' cosθ − sin θ ⎤⎡ ⎤
⎡⎢ ⎤⎥ ⎢⎥ ⎡ ⎥⎢ ⎥ ⎢ ⎥ ⎢ 0 ⎥⎢ ⎥ ⎡⎢ ⎥⎤ ⎢⎡ ⎥⎢ ⎥ ⎥
⎢⎢ y'⎥ ⎢0 cosθ − sin 0⎥⎢ ⎥y ⎢ y' ⎥ 10 0⎥⎢ y⎥ ⎢ y' ⎥ sin θ 0 0⎥⎢ y
⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢ 0 0 0 z⎥
⎥⎢
z'
⎢
0 θ 0⎥⎢ ⎥z z'⎢ − sin θ 0 cosθ 0 z z'⎢ cosθ
⎢⎣= ⎥ ⎢⎦ ⎢ ⎥
= ⎢ ⎥⎢ ⎥ ⎢= ⎥⎦ ⎢ 0 ⎥⎢ ⎥
1 0 sin θ cosθ 1 1
⎦⎣ ⎦ ⎣ ⎦1 ⎣ 00 0 1⎦⎣1⎦ ⎣ 1 0 1 1⎦⎣1⎦
⎣ 00 ⎣ 0 0
13-10-2022
3D
y
TRANSFORMATION y
x x
z z
13-10-2022
PROJECTION
• WHAT IS PROJECTION?
• Projection can be defined as a mapping of point P(x,y,z) into
its image P’(x’,y’,z’) in the projection plane which constitute
the display surface.
13-10-2022
PROJECTION
• CLASSIFICATION OF PROJECTION
PROJECTION
• 2 TYPES OF PROJECTIONS
• Parallel
• Perspective
13-10-2022
PROJECTION
• In parallel projection, coordinate positions are transformed to
the view plane along parallel lines.
13-10-2022
PROJECTION
• In perspective projection, object position are transformed to
the view plane along lines that converge to a point called
projection reference point (center of projection) .
13-10-2022
PROJECTION
• TYPES OF PARALLEL PROJECTIONS
13-10-2022
13-10-2022
13-10-2022
PROJECTION
• Orthographic projections are further classified as
• AXONOMETRIC PROJECTIONS
• The projection which can display more than one face of an
object is called as axonometric projection.
13-10-2022
PROJECTION
• Axonometric Projection has 3 types
13-10-2022
13-10-2022
PROJECTION
• MULTIVIEW PROJECTIONS
• Projection plane parallel to principal face. Usually forms front,
side or top view.
13-10-2022
PROJECTION
• Oblique Projections are further classified as
13-10-2022
PROJECTION
• CABINET:-In thisprojection lines makes angle of 45
degree with the view plane & length of projected line will
reduce.
13-10-2022
PROJECTION
• VANISHING POINT IN PERSPECTIVE PROJECTION
• The perspective projection of any set of parallel lines that are
not parallel to the projection plane converge to a vanishing
point.
• The vanishing point for any set of lines that are parallel to one
of the three principal axes of the object is referred to as a
principal vanishing point or axis vanishing point.
13-10-2022
PROJECTION
• There are 3 types of perspective projection:
13-10-2022
PROJECTION
• TWO-POINT PERSPECTIVE PROJECTION
13-10-2022
PROJECTION
• THREE-POINT PERSPECTIVE PROJECTION
13-10-2022