+ All Categories
Home > Documents > Computer Graphics 2D Affine Transformation

Computer Graphics 2D Affine Transformation

Date post: 18-Nov-2014
Category:
Upload: abbaqnadeem
View: 861 times
Download: 1 times
Share this document with a friend
16
Transcript
Page 1: Computer Graphics 2D Affine Transformation
Page 2: Computer Graphics 2D Affine Transformation

2D Affine Transformation

Presented ByAbbaq Nadeem

Page 3: Computer Graphics 2D Affine Transformation

Topic

2D Affine transformation

Page 4: Computer Graphics 2D Affine Transformation

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

2D Affine Transformations

5

x

yx

y

x

y

Page 6: Computer Graphics 2D Affine Transformation

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

7

Translation

How to translate an object with multiple vertices?

Translate individualvertices

Page 8: Computer Graphics 2D Affine Transformation

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

9

How to rotate an object with multiple vertices?

Rotate individualVertices

q

2D Rotation

Page 10: Computer Graphics 2D Affine Transformation

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

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

Finding Affine Transformations Image of 3 points determines affine transformation

12

Page 13: Computer Graphics 2D Affine Transformation

Finding Affine Transformations Image of 3 points determines affine transformation

13

Page 14: Computer Graphics 2D Affine Transformation

Finding Affine Transformations Image of 3 points determines affine transformation

14

P

q

rp’

q’r’

Page 15: Computer Graphics 2D Affine Transformation

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

Recommended