SlideShare a Scribd company logo
2D Geometric Transformations
Total Slide (51)
1
Geometric transformation means change in
 Place
 orientation
 Size
 Shape.
2
2D Translations.
2D Scaling
2D Rotation
2D shearing
Matrix Representation of 2D transformation
Formula for Transformation
Matrix of Transformed object= Matrix of object in 2D * Matrix of transformation
3
4
x y
x
y
Point defined as ( , ),
translate to Point ( , ) a distance d parallel to x axis, d parallel to y axis.
, ,
Now
x y
P P x y
P x y
x x d y y d
dx x
P P T
dy y
P P T
′ ′ ′
′ ′= + = +
′     
′= = =     ′     
′ = +
P
P’
Original Point, Transformed point and Displacement in X and
Y can be written in the form of matrix
5
 Component-wise addition
v’ = v + t where
and x’ = x + dx
y’ = y + dy
To move polygons: translate vertices of polygon after adding translation factors
and redraw lines between them.
 Translation always Preserves lengths and shape of object (Distortion in object
shape will not occur).
dx = 2
dy = 3
Y
X
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6






=





=





=
dy
dx
t
y
x
v
y
x
v ,
'
'
',






3
3






6
5
6












=





′
′
⋅=′






=
=′=′
′′′
y
x
.
0
0
y
x
or
Now
0
0
matrixtheDefine
.,.
axis.ythealongsand
axis,xthealongsfactoraby),(Pointto(stretch)scaleaPerform
),,(asdefinedPoint
y
x
y
x
y
x
yx
s
s
PSP
s
s
S
ysyxsx
yxP
yxPP
P
P’
After applying Scaling factor coordinates of
object is either increase or decrease. Expansion
and compression of object is depend upon the
scaling factor Sx and Sy.
Uniform Scaling
 If Sx = Sy < 1 Uniform compression occurs.
 If Sx = Sy > 1 Uniform Expansion Will occur.
 If Sx=Sy=1 No Change will occur.
Non uniform scaling
 If Sx ≠ Sy < 1 Non uniform compression occurs.
 If Sx ≠ Sy > 1 Non uniform expansion Will
occur.
7
 Uniform Scaling
 Non Uniform scaling
8
9
 Component-wise scalar multiplication of vectors
v’ = Sv where
and






=





=
'
'
',
y
x
v
y
x
v






=
y
x
s
s
S
0
0
ysy
xsx
y
x
=
=
'
'
Y
X
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
2
3
=
=
y
x
s
s






1
2






1
3 





2
6






2
9
 Add a 3rd coordinate to every 2D point. A point (a, b) in 2D can
be represented as (a,b,1) in homogeneous coordinate system.
Any point (x, y, w) where w!=0 represents a point at location
(x/w, y/w) in this coordinate system.
Point (2/3,4/3) can be represented in homogeneous coordinate
system (6,12,9)
2D case
3D Case
• Add a 4th coordinate to every 3D point. A point (a, b, c) in 3D can be
represented as (a,b,c,1) in homogeneous coordinate system.
Any point (x, y, z, w) in 3D where w!=0 represents a point at location
(x/w, y/w, z/w) in this coordinate system.
11
Example of Homogeneous
Coordinates
 Object coordinates are (00,10,11,01) Perform uniform expansion of this
object. Take scaling factor from your side.Draw final Figure also.
12
Q1. Write a 2X2 transformation matrix for each
of the following scaling transformation.
(1)The entire picture is 3 times as large.
(2)The entire picture is 1/3 as large.
(3)The X direction is 4 times as large and the y
direction unchanged.
(4) The x direction reduced to ¾ the original
and y direction increased by 7/5 times.
13
 Translate the square ABCD whose coordinates are A(0,0), B(3,0),c(3,3),
D(0,3).
 Translate this square 1.5 unit in x direction and 0.5 unit in y direction.
 After translation performing scaling with scaling factor sx=1.5 and
sy=0.5
14
 Find the transformation matrix that transforms
the square ABCD whose center is at (2,2) is
reduced to half of its size, with center still
remaining at (2,2). The coordinate of square
ABCD are A(0,0), B(0,4), C(4,4),D(4,0). Find the
coordinates of new square.
15
 Q: How can we represent translation as a
3x3 matrix?
y
x
tyy
txx
+=
+=
'
'










=
1
010
001
tytx
ranslationT
Example of translation










+
+
=




















=










11100
10
01
1
'
'
y
x
y
x
ty
tx
y
x
t
t
y
x
tx = 2
ty = 1
Homogeneous Coordinates
 Prove that two scaling transformation is
commutative
Commutative property is
S1.s2=s2.s1
 Prove that two successive translation are additive.
 Prove that two successive scaling is multiplicative
18
 Composite 2D Translation (Two successive
Translation)
),(
),(),(
2121
2211
yyxx
yxyx
tttt
ttttT
++=
⋅=
T
TT










+
+
=










⋅










100
10
01
100
10
01
100
10
01
21
21
1
1
2
2
yy
xx
y
x
y
x
tt
tt
t
t
t
t
Two Successive Translation is Additive
 Composite 2D Scaling (two successive
Scaling)
),(
),(),(
2121
2211
yyxx
yxyx
ssss
ssssT
S
SS
=
⋅=










⋅
⋅
=










⋅










100
00
00
100
00
00
100
00
00
21
21
1
1
2
2
yy
xx
y
x
y
x
ss
ss
s
s
s
s
Two Successive Scaling is Multiplicative
21
2D Rotation
22
y
x
r
r
P’(x’,y’)
P(x,y)
θ
φ
y
φ
φ
sin.
cos.
ry
rx
=
=
x
23
y
x
r
r
P’(x’,y’)
P(x,y)
θ
φ
y
φ
φ
sin.
cos.
ry
rx
=
=
x
θφθφφθ
θφθφφθ
cos.sin.sin.cos.)sin(.
sin.sin.cos.cos.)cos(.
rrry
rrrx
+=+=′
−=+=′
24
φ
φ
sin.
cos.
ry
rx
=
=
θφθφφθ
θφθφφθ
cos.sin.sin.cos.)sin(.
sin.sin.cos.cos.)cos(.
rrry
rrrx
+=+=′
−=+=′
Substituting for r :
Gives us :
θθ
θθ
cos.sin.
sin.cos.
yxy
yxx
+=′
−=′











 −
=





′
′
y
x
y
x
.
cossin
sincos
θθ
θθ
Rotation (Anticlockwise)












−
=





′
′
y
x
y
x
.
cossin
sincos
θθ
θθ
Rotation (Clockwise)
 Rotate a point (10,0) in anticlockwise direction
 Angle is 90 degree.
 After rotating this point rotate this point in
clockwise direction.
25





 −






=





′
′
θθ
θθ
cossin
sincos
y
x
y
x






−





=





′
′
θθ
θθ
cossin
sincos
y
x
y
x
Rotation (Clockwise)Rotation (Anti-Clockwise)
 Example
 Find the transformed point, P’, caused by
rotating P= (5, 1) about the origin through an
angle of 90°.






⋅+⋅
⋅−⋅
=





•




 −
θθ
θθ
θθ
θθ
cossin
sincos
cossin
sincos
yx
yx
y
x






⋅+⋅
⋅−⋅
=
90cos190sin5
90sin190cos5






⋅+⋅
⋅−⋅
=
0115
1105





−
=
5
1
27
 What happens when you apply a rotation
transformation to an object that is not at the
origin?
 Solution:
 Translate the center of rotation to the origin
 Rotate the object
 Translate back to the original location
 In matrix form, it can be shown as
Here
 TR is Translation Matrix (Translation towards Origin)
 RƟ is Rotation Matrix (Rotation Matrix can be clockwise and
anticlockwise Rotation)
 TR
-1
is Translation matrix (Away from origin)
29
[ ] [ ][ ][ ]
1
R RT T R Tθ
−
=
Rotating About An Arbitrary Point
x
y
x
y
x
y
x
y
 Consider the square A(1,0) B(0,0) C(0,1) D(1,1).
Rotate the square ABCD by 90 degree
clockwise about A(1,0). Apply rotation about
arbitrary point to solve this question.
31
 Translation.
 P′=T + P
 Scale
 P′=S ⋅ P
 Rotation
 P′=R ⋅ P
 We would like all transformations to be
multiplications
32
33
 Translate [1,3] by [7,9]
 Scale [2,3] by 5 in the X direction and 10 in the Y direction

Rotate [2,2] by 90°
(π/2)










=










⋅










1
12
8
1
3
1
100
910
701










=










⋅










1
30
10
1
3
2
100
0100
005









−
=










⋅









 −
=










⋅









 −
1
2
2
1
2
2
100
001
010
1
2
2
100
0)2/cos()2/sin(
0)2/sin()2/cos(
ππ
ππ
34
Shearing Transformation
The shearing transformation when applied to the object it results
distortion of shape.
Types of Shearing Transformation
X- shear: In X-shear y coordinate remain unchanged, but x is
changed.
Y- shear: In Y-shear x coordinate remain unchanged, but y is
changed
' 1
' 0 1
x x Shy
y y
     
=     
     
X- Shear Y- Shear
' 1 0
' 1
x x
y y shx
     
=     
     
 Shear following object 2 unit in x direction and
2 unit in y direction.
 Object coordinates are (00,10,11,01).
35
 Basic 2D transformations as 3x3 matrices




















ΘΘ
Θ−Θ
=










1100
0cossin
0sincos
1
'
'
y
x
y
x




















=










1100
10
01
1
'
'
y
x
t
t
y
x
y
x




















=










1100
01
01
1
'
'
y
x
sh
sh
y
x
x
y
Translate
Rotate Shear




















=










1100
00
00
1
'
'
y
x
s
s
y
x
y
x
Scale
 Transformations can be combined by
matrix multiplication
































ΘΘ
Θ−Θ








=








w
y
x
sy
sx
ty
tx
w
y
x
100
00
00
100
0cossin
0sincos
100
10
01
'
'
'
p’ = T(tx,ty) R(Θ) S(sx,sy) p
 Rotation with respect to a pivot point (x,y)
* ( , ) ( ) ( , )
1 0 cos sin 0 1 0
* 0 1 sin cos 0 0 1
0 0 1 0 0 1 0 0 1
Object T x y R T x y
x x
Object y y
θ
θ θ
θ θ
− − × ×
− −     
 ÷  ÷  ÷
= − × × ÷  ÷  ÷
 ÷  ÷  ÷
     
 Steps for Fix point Scaling
 Translate point to origin (Fig (b))
 Perform Scaling Fig(c) Expansion or
compression
 Inverse Translation Fig(d)
39
 Scaling with respect to a fixed point (x,y)
* ( , ) ( , ) ( , )
1 0 0 0 0 1 0 0
* 0 1 0 0 0 0 1 0
1 0 0 1 1
x y
x
y
Object T x y S s s T x y
s
Object s
x y x y
− − × ×
     
 ÷  ÷  ÷
= × × ÷  ÷  ÷
 ÷  ÷  ÷− −     
 Q1. Magnify the triangle with vertices A(0,0),
B(1,1), C(5,2) to twice its size while keeping
c(5,2) fixed.
41
 Composite 2D Rotation (Two Successive
Rotation)
)(
)()(
12
12
θθ
θθ
+=
⋅=
R
RRT










++
+−+
=









 −
⋅









 −
100
0)cos()sin(
0)sin()cos(
100
0cossin
0sincos
100
0cossin
0sincos
1212
1212
11
11
22
22
θθθθ
θθθθ
θθ
θθ
θθ
θθ
Two Successive Rotation is Additive
43
Thanks !!

More Related Content

What's hot

UNIT-IV
UNIT-IVUNIT-IV
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
Kongunadu College of engineering and Technology, Namakkal
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformationsMohammad Sadiq
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)
RohitK71
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
Ankit Surti
 
2d transformation
2d transformation2d transformation
2d transformation
Sarkunavathi Aribal
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
KALESHWAR KUMAR
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
Ankur Kumar
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.Mohd Arif
 
Reflection transformation
Reflection transformationReflection transformation
Reflection transformation
Mani Kanth
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
Mani Kanth
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
sabbirantor
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transform
Patel Punit
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
Pooja Dixit
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
Ahtesham Ullah khan
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
SHIVANI SONI
 

What's hot (20)

UNIT-IV
UNIT-IVUNIT-IV
UNIT-IV
 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
2d transformation
2d transformation2d transformation
2d transformation
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
Reflection transformation
Reflection transformationReflection transformation
Reflection transformation
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transform
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
 
Illumination Models & Shading
Illumination Models & ShadingIllumination Models & Shading
Illumination Models & Shading
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 

Similar to 2 d transformation

Transforms UNIt 2
Transforms UNIt 2 Transforms UNIt 2
Transforms UNIt 2
sandeep kumbhkar
 
Computer Graphics - transformations in 2d
Computer Graphics - transformations in 2dComputer Graphics - transformations in 2d
Computer Graphics - transformations in 2d
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
2013901097
 
Matrix 2 d
Matrix 2 dMatrix 2 d
Matrix 2 dxyz120
 
06.Transformation.ppt
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
RobinAhmedSaikat
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
ShubhamBatwani
 
Matrix 2 d
Matrix 2 dMatrix 2 d
Matrix 2 d
xyz120
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformations
Nareek
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
Amit Kapoor
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling Transformations
Tarun Gehlot
 
Computer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3dComputer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3d
2013901097
 
Computer Graphics - transformations in 3d
Computer Graphics - transformations in 3dComputer Graphics - transformations in 3d
Computer Graphics - transformations in 3d
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Lecture 6-1543909797
Lecture 6-1543909797Lecture 6-1543909797
Lecture 6-1543909797
Canh Le
 
2d transformations
2d transformations2d transformations
2d transformations
rajeshranjithsingh
 
Part 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptxPart 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptx
Khalil Alhatab
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptx
Khalil Alhatab
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
Khalil Alhatab
 
2-D Transformations.pdf
2-D Transformations.pdf2-D Transformations.pdf
2-D Transformations.pdf
Mattupallipardhu
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Bala Murali
 
2D-transformation-1.pdf
2D-transformation-1.pdf2D-transformation-1.pdf
2D-transformation-1.pdf
bcanawakadalcollege
 

Similar to 2 d transformation (20)

Transforms UNIt 2
Transforms UNIt 2 Transforms UNIt 2
Transforms UNIt 2
 
Computer Graphics - transformations in 2d
Computer Graphics - transformations in 2dComputer Graphics - transformations in 2d
Computer Graphics - transformations in 2d
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
 
Matrix 2 d
Matrix 2 dMatrix 2 d
Matrix 2 d
 
06.Transformation.ppt
06.Transformation.ppt06.Transformation.ppt
06.Transformation.ppt
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
 
Matrix 2 d
Matrix 2 dMatrix 2 d
Matrix 2 d
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformations
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling Transformations
 
Computer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3dComputer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3d
 
Computer Graphics - transformations in 3d
Computer Graphics - transformations in 3dComputer Graphics - transformations in 3d
Computer Graphics - transformations in 3d
 
Lecture 6-1543909797
Lecture 6-1543909797Lecture 6-1543909797
Lecture 6-1543909797
 
2d transformations
2d transformations2d transformations
2d transformations
 
Part 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptxPart 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptx
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptx
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
 
2-D Transformations.pdf
2-D Transformations.pdf2-D Transformations.pdf
2-D Transformations.pdf
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
2D-transformation-1.pdf
2D-transformation-1.pdf2D-transformation-1.pdf
2D-transformation-1.pdf
 

More from Ankit Garg

Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2
Ankit Garg
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
Ankit Garg
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
Ankit Garg
 
Projection ppt
Projection pptProjection ppt
Projection ppt
Ankit Garg
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
Ankit Garg
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
Ankit Garg
 
Numerical unit 1
Numerical unit 1Numerical unit 1
Numerical unit 1
Ankit Garg
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
Ankit Garg
 
Line clipping
Line clippingLine clipping
Line clipping
Ankit Garg
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
Ankit Garg
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standards
Ankit Garg
 
Fractal introduction and applications modified version
Fractal introduction and applications modified versionFractal introduction and applications modified version
Fractal introduction and applications modified version
Ankit Garg
 
Digital image processing &amp; computer graphics
Digital image processing &amp; computer graphicsDigital image processing &amp; computer graphics
Digital image processing &amp; computer graphics
Ankit Garg
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
Ankit Garg
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Character generation
Character generationCharacter generation
Character generation
Ankit Garg
 
Applications of cg
Applications of cgApplications of cg
Applications of cg
Ankit Garg
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
Ankit Garg
 

More from Ankit Garg (19)

Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
Unit 1
Unit 1Unit 1
Unit 1
 
Projection ppt
Projection pptProjection ppt
Projection ppt
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Numerical unit 1
Numerical unit 1Numerical unit 1
Numerical unit 1
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
Line clipping
Line clippingLine clipping
Line clipping
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standards
 
Fractal introduction and applications modified version
Fractal introduction and applications modified versionFractal introduction and applications modified version
Fractal introduction and applications modified version
 
Digital image processing &amp; computer graphics
Digital image processing &amp; computer graphicsDigital image processing &amp; computer graphics
Digital image processing &amp; computer graphics
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Character generation
Character generationCharacter generation
Character generation
 
Applications of cg
Applications of cgApplications of cg
Applications of cg
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
 

Recently uploaded

WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 

Recently uploaded (20)

WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 

2 d transformation

  • 2. Geometric transformation means change in  Place  orientation  Size  Shape. 2
  • 3. 2D Translations. 2D Scaling 2D Rotation 2D shearing Matrix Representation of 2D transformation Formula for Transformation Matrix of Transformed object= Matrix of object in 2D * Matrix of transformation 3
  • 4. 4 x y x y Point defined as ( , ), translate to Point ( , ) a distance d parallel to x axis, d parallel to y axis. , , Now x y P P x y P x y x x d y y d dx x P P T dy y P P T ′ ′ ′ ′ ′= + = + ′      ′= = =     ′      ′ = + P P’ Original Point, Transformed point and Displacement in X and Y can be written in the form of matrix
  • 5. 5  Component-wise addition v’ = v + t where and x’ = x + dx y’ = y + dy To move polygons: translate vertices of polygon after adding translation factors and redraw lines between them.  Translation always Preserves lengths and shape of object (Distortion in object shape will not occur). dx = 2 dy = 3 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6       =      =      = dy dx t y x v y x v , ' ' ',       3 3       6 5
  • 7. After applying Scaling factor coordinates of object is either increase or decrease. Expansion and compression of object is depend upon the scaling factor Sx and Sy. Uniform Scaling  If Sx = Sy < 1 Uniform compression occurs.  If Sx = Sy > 1 Uniform Expansion Will occur.  If Sx=Sy=1 No Change will occur. Non uniform scaling  If Sx ≠ Sy < 1 Non uniform compression occurs.  If Sx ≠ Sy > 1 Non uniform expansion Will occur. 7
  • 8.  Uniform Scaling  Non Uniform scaling 8
  • 9. 9  Component-wise scalar multiplication of vectors v’ = Sv where and       =      = ' ' ', y x v y x v       = y x s s S 0 0 ysy xsx y x = = ' ' Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 2 3 = = y x s s       1 2       1 3       2 6       2 9
  • 10.  Add a 3rd coordinate to every 2D point. A point (a, b) in 2D can be represented as (a,b,1) in homogeneous coordinate system. Any point (x, y, w) where w!=0 represents a point at location (x/w, y/w) in this coordinate system. Point (2/3,4/3) can be represented in homogeneous coordinate system (6,12,9) 2D case 3D Case • Add a 4th coordinate to every 3D point. A point (a, b, c) in 3D can be represented as (a,b,c,1) in homogeneous coordinate system. Any point (x, y, z, w) in 3D where w!=0 represents a point at location (x/w, y/w, z/w) in this coordinate system.
  • 12.  Object coordinates are (00,10,11,01) Perform uniform expansion of this object. Take scaling factor from your side.Draw final Figure also. 12
  • 13. Q1. Write a 2X2 transformation matrix for each of the following scaling transformation. (1)The entire picture is 3 times as large. (2)The entire picture is 1/3 as large. (3)The X direction is 4 times as large and the y direction unchanged. (4) The x direction reduced to ¾ the original and y direction increased by 7/5 times. 13
  • 14.  Translate the square ABCD whose coordinates are A(0,0), B(3,0),c(3,3), D(0,3).  Translate this square 1.5 unit in x direction and 0.5 unit in y direction.  After translation performing scaling with scaling factor sx=1.5 and sy=0.5 14
  • 15.  Find the transformation matrix that transforms the square ABCD whose center is at (2,2) is reduced to half of its size, with center still remaining at (2,2). The coordinate of square ABCD are A(0,0), B(0,4), C(4,4),D(4,0). Find the coordinates of new square. 15
  • 16.  Q: How can we represent translation as a 3x3 matrix? y x tyy txx += += ' '           = 1 010 001 tytx ranslationT
  • 18.  Prove that two scaling transformation is commutative Commutative property is S1.s2=s2.s1  Prove that two successive translation are additive.  Prove that two successive scaling is multiplicative 18
  • 19.  Composite 2D Translation (Two successive Translation) ),( ),(),( 2121 2211 yyxx yxyx tttt ttttT ++= ⋅= T TT           + + =           ⋅           100 10 01 100 10 01 100 10 01 21 21 1 1 2 2 yy xx y x y x tt tt t t t t Two Successive Translation is Additive
  • 20.  Composite 2D Scaling (two successive Scaling) ),( ),(),( 2121 2211 yyxx yxyx ssss ssssT S SS = ⋅=           ⋅ ⋅ =           ⋅           100 00 00 100 00 00 100 00 00 21 21 1 1 2 2 yy xx y x y x ss ss s s s s Two Successive Scaling is Multiplicative
  • 24. 24 φ φ sin. cos. ry rx = = θφθφφθ θφθφφθ cos.sin.sin.cos.)sin(. sin.sin.cos.cos.)cos(. rrry rrrx +=+=′ −=+=′ Substituting for r : Gives us : θθ θθ cos.sin. sin.cos. yxy yxx +=′ −=′             − =      ′ ′ y x y x . cossin sincos θθ θθ Rotation (Anticlockwise)             − =      ′ ′ y x y x . cossin sincos θθ θθ Rotation (Clockwise)
  • 25.  Rotate a point (10,0) in anticlockwise direction  Angle is 90 degree.  After rotating this point rotate this point in clockwise direction. 25       −       =      ′ ′ θθ θθ cossin sincos y x y x       −      =      ′ ′ θθ θθ cossin sincos y x y x Rotation (Clockwise)Rotation (Anti-Clockwise)
  • 26.  Example  Find the transformed point, P’, caused by rotating P= (5, 1) about the origin through an angle of 90°.       ⋅+⋅ ⋅−⋅ =      •      − θθ θθ θθ θθ cossin sincos cossin sincos yx yx y x       ⋅+⋅ ⋅−⋅ = 90cos190sin5 90sin190cos5       ⋅+⋅ ⋅−⋅ = 0115 1105      − = 5 1
  • 27. 27
  • 28.  What happens when you apply a rotation transformation to an object that is not at the origin?  Solution:  Translate the center of rotation to the origin  Rotate the object  Translate back to the original location
  • 29.  In matrix form, it can be shown as Here  TR is Translation Matrix (Translation towards Origin)  RƟ is Rotation Matrix (Rotation Matrix can be clockwise and anticlockwise Rotation)  TR -1 is Translation matrix (Away from origin) 29 [ ] [ ][ ][ ] 1 R RT T R Tθ − =
  • 30. Rotating About An Arbitrary Point x y x y x y x y
  • 31.  Consider the square A(1,0) B(0,0) C(0,1) D(1,1). Rotate the square ABCD by 90 degree clockwise about A(1,0). Apply rotation about arbitrary point to solve this question. 31
  • 32.  Translation.  P′=T + P  Scale  P′=S ⋅ P  Rotation  P′=R ⋅ P  We would like all transformations to be multiplications 32
  • 33. 33  Translate [1,3] by [7,9]  Scale [2,3] by 5 in the X direction and 10 in the Y direction  Rotate [2,2] by 90° (π/2)           =           ⋅           1 12 8 1 3 1 100 910 701           =           ⋅           1 30 10 1 3 2 100 0100 005          − =           ⋅           − =           ⋅           − 1 2 2 1 2 2 100 001 010 1 2 2 100 0)2/cos()2/sin( 0)2/sin()2/cos( ππ ππ
  • 34. 34 Shearing Transformation The shearing transformation when applied to the object it results distortion of shape. Types of Shearing Transformation X- shear: In X-shear y coordinate remain unchanged, but x is changed. Y- shear: In Y-shear x coordinate remain unchanged, but y is changed ' 1 ' 0 1 x x Shy y y       =            X- Shear Y- Shear ' 1 0 ' 1 x x y y shx       =           
  • 35.  Shear following object 2 unit in x direction and 2 unit in y direction.  Object coordinates are (00,10,11,01). 35
  • 36.  Basic 2D transformations as 3x3 matrices                     ΘΘ Θ−Θ =           1100 0cossin 0sincos 1 ' ' y x y x                     =           1100 10 01 1 ' ' y x t t y x y x                     =           1100 01 01 1 ' ' y x sh sh y x x y Translate Rotate Shear                     =           1100 00 00 1 ' ' y x s s y x y x Scale
  • 37.  Transformations can be combined by matrix multiplication                                 ΘΘ Θ−Θ         =         w y x sy sx ty tx w y x 100 00 00 100 0cossin 0sincos 100 10 01 ' ' ' p’ = T(tx,ty) R(Θ) S(sx,sy) p
  • 38.  Rotation with respect to a pivot point (x,y) * ( , ) ( ) ( , ) 1 0 cos sin 0 1 0 * 0 1 sin cos 0 0 1 0 0 1 0 0 1 0 0 1 Object T x y R T x y x x Object y y θ θ θ θ θ − − × × − −       ÷  ÷  ÷ = − × × ÷  ÷  ÷  ÷  ÷  ÷      
  • 39.  Steps for Fix point Scaling  Translate point to origin (Fig (b))  Perform Scaling Fig(c) Expansion or compression  Inverse Translation Fig(d) 39
  • 40.  Scaling with respect to a fixed point (x,y) * ( , ) ( , ) ( , ) 1 0 0 0 0 1 0 0 * 0 1 0 0 0 0 1 0 1 0 0 1 1 x y x y Object T x y S s s T x y s Object s x y x y − − × ×        ÷  ÷  ÷ = × × ÷  ÷  ÷  ÷  ÷  ÷− −     
  • 41.  Q1. Magnify the triangle with vertices A(0,0), B(1,1), C(5,2) to twice its size while keeping c(5,2) fixed. 41
  • 42.  Composite 2D Rotation (Two Successive Rotation) )( )()( 12 12 θθ θθ += ⋅= R RRT           ++ +−+ =           − ⋅           − 100 0)cos()sin( 0)sin()cos( 100 0cossin 0sincos 100 0cossin 0sincos 1212 1212 11 11 22 22 θθθθ θθθθ θθ θθ θθ θθ Two Successive Rotation is Additive