computer graphics 2d affine transformation
TRANSCRIPT
![Page 1: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/1.jpg)
![Page 2: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/2.jpg)
2D Affine Transformation
Presented ByAbbaq Nadeem
![Page 3: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/3.jpg)
Topic
2D Affine transformation
![Page 4: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/4.jpg)
Affine Transformation
• Translation, Scaling, Rotation, Shearing are all affine transformation
• Affine transformation – transformed point P’ (x’,y’) is a linear combination of the original point P (x,y), i.e.
• Any 2D affine transformation can be decomposed into a rotation, followed by a scaling, followed by a shearing, and followed by a translation.
Affine matrix = translation x shearing x scaling x rotation
4
11001232221
131211
y
x
mmm
mmm
y
x
![Page 5: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/5.jpg)
2D Affine Transformations
5
x
yx
y
x
y
![Page 6: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/6.jpg)
6
Translation Re-position a point along a straight line Given a point (x,y), and the translation
distance (tx,ty)
The new point: (x’, y’) x’ = x + tx y’ = y + ty (x,y)
(x’,y’)
OR P’ = P + T where P’ = x’ p = x T = tx y’ y ty
tx
ty
![Page 7: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/7.jpg)
7
Translation
How to translate an object with multiple vertices?
Translate individualvertices
![Page 8: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/8.jpg)
8
2D Rotation
Default rotation center: Origin (0,0)
qq> 0 : Rotate counter clockwise
q< 0 : Rotate clockwise q
![Page 9: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/9.jpg)
9
How to rotate an object with multiple vertices?
Rotate individualVertices
q
2D Rotation
![Page 10: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/10.jpg)
2D Scaling
10
(1,1)
(2,2) Sx = 2, Sy = 2
(2,2)
(4,4)
Not only the object size is changed, it also moved!! Usually this is an undesirable effect
![Page 11: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/11.jpg)
Shearing
Y coordinates are unaffected, but x coordinates are translated linearly with y
That is: y’ = y x’ = x + y * h
11
x 1 h 0 xy = 0 1 0 * y1 0 0 1 1
![Page 12: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/12.jpg)
Finding Affine Transformations Image of 3 points determines affine transformation
12
![Page 13: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/13.jpg)
Finding Affine Transformations Image of 3 points determines affine transformation
13
![Page 14: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/14.jpg)
Finding Affine Transformations Image of 3 points determines affine transformation
14
P
q
rp’
q’r’
![Page 15: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/15.jpg)
15
Finding Affine Transformations Image of 3 points determines affine transformation
q
rp’
q’r’
P
What’s the corresponding point in the right image?
![Page 16: Computer Graphics 2D Affine Transformation](https://reader033.vdocuments.mx/reader033/viewer/2022061118/546a4356af79597b298b45b6/html5/thumbnails/16.jpg)