0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Two dimentional transform

850

Published on

2D transformation

2D transformation

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
850
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
92
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Transformation&#xF097;An operation that changes one configuration intoanother&#xF097;Types of Transformation:&#xF097;Geometric transformation&#xF097; Object itself is transformed relative to a stationary co-ordinate&#xF097;Co-ordinate transformation&#xF097; Co-ordinate system is transformed relative to an object.&#xF097; Object is held stationary
• 2. 2D Geometric Transformations&#xF097;A two dimensional transformation is any operationon a point in space (x, y) that maps that pointscoordinates into a new set of coordinates (x1, y1).&#xF097;Instead of applying a transformation to every point inevery line that makes up an object, the transformationis applied only to the vertices of the object and thennew lines are drawn between the resulting endpoints.
• 3. 2D Geometric TransformationsTranslateRotate ScaleShear
• 4. 2D Translation&#xF097;One of rigid-body transformation, which move objects withoutdeformation&#xF097;Translate an object by Adding offsets to coordinates to generatenew coordinates positions&#xF097;Set tx, ty be the translation distance, we have&#xF097;P&#x2019;=P+T&#xF097;Translation moves the object without deformationPP&#x2019;Txtxx += ytyy +=&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;=yxP &#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;=yxttT&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;=yxP
• 5. Basic 2D Translation&#xF097;To move a line segment, apply thetransformation equation to each of the twoline endpoints and redraw the line betweennew endpoints&#xF097;To move a polygon, apply the transformationequation to coordinates of each vertex andregenerate the polygon using the new set ofvertex coordinates
• 6. ExampleTranslate a polygon with coordinatesA(2,5), B(7,10) and c(10,2) by 3 units inx direction and 4 units in y direction
• 7. 2D Rotation&#xF097;Object is rotated &#x3F4;&#xB0; about the origin.&#xF097;&#x3F4; &gt; 0 &#x2013; rotation is counter clock wise&#xF097;&#x3F4; &lt; 0 &#x2013; rotation is clock wise6&#x3C0;&#x3B8; =yx011223 4 5 6 7 8 9 103456
• 8. 2-D Rotationx = r cos (&#x3C6;)y = r sin (&#x3C6;)x&#x2019; = r cos (&#x3C6; + &#x3B8;)y&#x2019; = r sin (&#x3C6; + &#x3B8;)Trig Identity&#x2026;x&#x2019; = r cos(&#x3C6;) cos(&#x3B8;) &#x2013; r sin(&#x3C6;)sin(&#x3B8;)y&#x2019; = r sin(&#x3C6;) sin(&#x3B8;) + r cos(&#x3C6;)cos(&#x3B8;)Substitute&#x2026;x&#x2019; = x cos(&#x3B8;) - y sin(&#x3B8;)y&#x2019; = x sin(&#x3B8;) + y cos(&#x3B8;)&#x3B8;(x, y)(x&#x2019;, y&#x2019;)&#x3C6;
• 9. Basic 2D Geometric Transformations&#xF097;2D Rotation matrix&#xF097;P&#x2019;=R&#x387;P&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;&#x398;&#x398;&#x398;&#x2212;&#x398;=cossinsincosR&#x3A6;&#x3A6;(x,y)rr &#x3B8;(x&#x2019;,y&#x2019;)&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE; &#x2212;=&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;yxyx&#x3B8;&#x3B8;&#x3B8;&#x3B8;cossinsincos
• 10. Basic 2D Geometric Transformations&#xF097;2D Rotation&#xF097;Rotation for a point about any specifiedposition (xr, yr)x&#x2019;=xr+(x - xr) cos &#x3B8; &#x2013; (y - yr) sin &#x3B8;y&#x2019;=yr+(x - xr) sin &#x3B8; + (y - yr) cos &#x3B8;
• 11. &#xF097;Rotations also move objects withoutdeformation&#xF097;A line is rotated by applying the rotationformula to each of the endpoints and redrawingthe line between the new end points&#xF097;A polygon is rotated by applying the rotationformula to each of the vertices and redrawingthe polygon using new vertex coordinates
• 12. Example&#xF097;A point (4,3) is rotatedcounterclockwise by an angle 45&#xB0;find the rotation matrix andresultant point.
• 13. Basic 2D Geometric Transformations&#xF097;2D Scaling&#xF097;Scaling is the process of expanding or compressingthe dimension of an object&#xF097;Simple 2D scaling is performed by multiplying objectpositions (x, y) by scaling factors sx and syx&#x2019; = x &#x387; sxy&#x2019; = y &#x387; sy&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;=&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;yxssyxyx00P(x,y)P&#x2019;(x&#x2019;,y&#x2019;)xsx&#x2022; xsy&#x2022; yy
• 14. &#xF097;2D Scaling&#xF097;Any positive value can beused as scaling factor&#xF097; Sf &lt; 1 reduce the size of theobject&#xF097; Sf &gt; 1 enlarge the object&#xF097; Sf = 1 then the object staysunchanged&#xF097; If sx= sy, we call it uniformscaling&#xF097; If scaling factor &lt;1, then theobject moves closer to theorigin and If scaling factor &gt;1,then the object moves fartherfrom the originyx011223 4 5 6 7 8 9 103456&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;12&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;13&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;36&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8F0;&#xF8EE;39
• 15. Basic 2D Geometric Transformations&#xF097;2D Scaling&#xF097;We can control the location of the scaled object bychoosing a position called the fixed point (xf, yf)x&#x2019; &#x2013; xf = (x &#x2013; xf) sx y&#x2019; &#x2013; yf = (y &#x2013; yf) syx&#x2019;=x &#x387; sx+ xf (1 &#x2013; sx)y&#x2019;=y &#x387; sy+ yf (1 &#x2013; sy)&#xF097;Polygons are scaled by applying the above formula toeach vertex, then regenerating the polygon using thetransformed vertices
• 16. Example&#xF097;Scale the polygon with co-ordinatesA(2,5), B(7,10) and c(10,2) by 2 units inx direction and 2 units in y direction
• 17. Homogeneous Coordinates&#xF097;Expand each 2D coordinate (x, y) to three elementrepresentation (xh, yh, h) called homogenouscoordinates&#xF097;h is the homogenous parameter such thatx = xh/h, y = yh/h,&#xF097;A convenient choice is to choose h = 1
• 18. Homogeneous Coordinates for translation&#xF097;2D Translation Matrixor, P&#x2019; = T(tx,ty)&#x387;P&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;110010011yxttyxyx
• 19. Homogeneous Coordinates forrotation&#xF097;2D Rotation Matrixor, P&#x2019; = R(&#x3B8;)&#x387;P&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x398;&#x398;&#x398;&#x2212;&#x398;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;11000cossin0sincos1yxyx
• 20. Homogeneous Coordinates for scaling&#xF097;2D Scaling Matrixor, P&#x2019; = S(sx,sy)&#x387;P&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;110000001yxssyxyx
• 21. Inverse Transformations&#xF097;2D Inverse Translation Matrix&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;&#x2212;=&#x2212;10010011yxttT
• 22. Inverse Transformations&#xF097;2D Inverse Rotation Matrix&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x398;&#x398;&#x2212;&#x398;&#x398;=&#x2212;1000cossin0sincos1R
• 23. Inverse Transformations&#xF097;2D Inverse Scaling Matrix&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;=&#x2212;1000100011yxssS
• 24. 2D Composite Transformations&#xF097;We can setup a sequence of transformations asa composite transformation matrix bycalculating the product of the individualtransformations&#xF097;P&#x2019;=M2&#x387;M1&#x387;PP&#x2019;=M&#x387;P
• 25. 2D Composite Transformations&#xF097;Composite 2D Translations&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;++=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;10010011001001100100121211122yyxxyxyxtttttttt
• 26. 2D Composite Transformations&#xF097;Composite 2D Rotations&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x398;+&#x398;&#x398;+&#x398;&#x398;+&#x398;&#x2212;&#x398;+&#x398;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x398;&#x398;&#x398;&#x2212;&#x398;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x398;&#x398;&#x398;&#x2212;&#x398;1000)cos()sin(0)sin()cos(1000cossin0sincos1000cossin0sincos2121212111112222
• 27. 2D Composite Transformations&#xF097;Composite 2D Scaling&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#x22C5;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;10000001000000100000021211122yyxxyxyxssssssss
• 28. &#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;&#x2212;+&#x2212;&#x2212;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;&#x2212;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE; &#x2212;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;100sin)cos1(cossinsin)cos1(sincos10010011000cossin0sincos1001001&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;&#x3B8;rrrrrrrrxyyxyxyx( ) ( ) ( ) ( )&#x3B8;&#x3B8; ,,,, rrrrrr yxRyxTRyxT =&#x2212;&#x2212;&#x22C5;&#x22C5;Translate Rotate Translate(xr,yr)(xr,yr)(xr,yr)(xr,yr)
• 29. &#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;&#x2212;=&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;&#x2212;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x22C5;&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;100)1(0)1(0100100110000001001001yfyxfxffxffsyssxsyxssyxyTranslate Scale Translate(xr,yr)(xr,yr)(xr,yr)(xr,yr)( ) ( ) ( ) ( )yxffffyxff ssyxSyxTssSyxT ,,,, ,, =&#x2212;&#x2212;&#x22C5;&#x22C5;
• 30. Another Example.ScaleTranslateRotateTranslate
• 31. ExampleI sat in the car, and find the side mirror is 0.4m onmy right and 0.3m in my front&#x2022; I started my car and drove 5m forward, turned 30degrees to right, moved 5m forward again, andturned 45 degrees to the right, and stopped&#x2022; What is the position of the side mirror now,relative to where I was sitting in the beginning?
• 32. Other Two Dimensional Transformations&#xF097;Reflection&#xF097;Transformation that produces a mirrorimage of an object&#xF097;Image is generated relative to an axis ofreflection by rotating the object 180&#xB0;about the reflection axis
• 33. Reflection about the line y=0 (the x axis)&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;100010001
• 34. Reflection about the line x=0 (the y axis)&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;100010001
• 35. Reflection about the origin&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;&#x2212;&#x2212;100010001
• 36. Reflection when x = y
• 37. Example&#xF097;Consider the triangle ABC with co-ordinates x(4,1), y(5,2), z(4,3). Reflectthe triangle about the x axis and thenabout the line y = -x
• 38. Shear&#xF097;Transformation that distorts the shape of anobject is called shear transformation.&#xF097;Two shearing transformation used:&#xF097; Shift X co-ordinates values&#xF097; Shift Y co-ordinates values
• 39. X shearyx(0,1) (1,1)(1,0)(0,0)yx(2,1) (3,1)(1,0)(0,0)shx=2&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;10001001 xshyyyshxx x=&#x22C5;+=&#xF097;Preserve Y coordinates but change the X coordinates values
• 40. Y shear&#xF097;Preserve X coordinates but change the Y coordinates valuesx&#x2019; = xy&#x2019; = y + Shy . xyx(0,1) (1,1)(1,0)(0,0)yx(0,1)(1,2)(1,1)(0,0)&#xF8FA;&#xF8FA;&#xF8FA;&#xF8FB;&#xF8F9;&#xF8EF;&#xF8EF;&#xF8EF;&#xF8F0;&#xF8EE;10001001ysh
• 41. Example&#xF097;Perform x shear and y shear along ona triangle A(2,1), B(4,3), C(2,3) sh = 2
• 42. Shear relative to other axis&#xF097;X shear with reference to Y axisxy11yref = -1xshx = &#xBD;, yref = -111 2 3yref = -1( )x refx x sh y yy y&#x2032; = + &#x2212;&#x2032; =10 1 01 0 0 1 1x x refx sh sh y xy y&#x2032; &#x2212; &#xD7;&#xF8EB; &#xF8F6; &#xF8EB; &#xF8F6;&#xF8EB; &#xF8F6;&#xF8EC; &#xF7; &#xF8EC; &#xF7;&#xF8EC; &#xF7;&#x2032; =&#xF8EC; &#xF7; &#xF8EC; &#xF7;&#xF8EC; &#xF7;&#xF8EC; &#xF7; &#xF8EC; &#xF7;&#xF8EC; &#xF7;&#xF8ED; &#xF8F8; &#xF8ED; &#xF8F8;&#xF8ED; &#xF8F8;
• 43. Shear relative to other axis&#xF097;Y shear with reference to X axis( )y refx xy y sh x x&#x2032; =&#x2032; = + &#x2212;1 0 011 0 0 1 1x y refx xy sh sh x y&#x2032;&#xF8EB; &#xF8F6; &#xF8EB; &#xF8F6;&#xF8EB; &#xF8F6;&#xF8EC; &#xF7; &#xF8EC; &#xF7;&#xF8EC; &#xF7;&#x2032; = &#x2212; &#xD7;&#xF8EC; &#xF7; &#xF8EC; &#xF7;&#xF8EC; &#xF7;&#xF8EC; &#xF7; &#xF8EC; &#xF7;&#xF8EC; &#xF7;&#xF8ED; &#xF8F8; &#xF8ED; &#xF8F8;&#xF8ED; &#xF8F8;xy11xref = -1yx112xref = -1
• 44. Example&#xF097;Apply shearing transformation to square withA(0,0), B(1,0), C(1,1), D(0,1).&#xF097;Shear parameter value is 0.5 relative to lineYref = - 1 and Xref = - 1
• 45. 321321321 M)MM()MM(MMMM &#x22C5;&#x22C5;=&#x22C5;&#x22C5;=&#x22C5;&#x22C5;&#xF097;Associative properties&#xF097;Transformation is not commutative (CopyCD!)&#xF097;Order of transformation may affect transformationpositionMatrix Concatenation Properties
• 46. Transformations between 2DTransformations between 2DCoordinate SystemsCoordinate Systems&#xF097;To translate object descriptions from xy coordinates to x&#x2019;y&#x2019;coordinates, we set up a transformation that superimposesthe x&#x2019;y&#x2019; axes onto the xy axes. This is done in two steps:1. Translate so that the origin (x0, y0) of the x&#x2019;y&#x2019; system ismoved to the origin (0, 0) of the xy system.2. Rotate the x&#x2019; axis onto the x axis.xyx0x&#x2019;y&#x2019;y0&#x3B8;
• 47. &#xF097;Translation&#xF097;(x&#x2019;,y&#x2019;)=Tv(x,y)&#xF097;x&#x2019;= x &#x2013; tx&#xF097;y&#x2019;=y-ty&#xF097;Rotation about origin&#xF097;(x&#x2019;,y&#x2019;)=R&#x3F4;(x,y)&#xF097;x&#x2019;= xcos&#x3F4; + ysin&#x3F4;&#xF097;y&#x2019;= -xsin&#x3F4; + ycos&#x3F4;&#xF097;Scaling with origin&#xF097;(x&#x2019;, y&#x2019;)=Ssx, sy(x,y)&#xF097;x&#x2019;= (1/sx)x&#xF097;y&#x2019;= (1/sy)y&#xF097;Reflection about Xaxis&#xF097;(x&#x2019;,y&#x2019;)= Mx(x,y)&#xF097;x&#x2019;= x&#xF097;y&#x2019;= -y&#xF097;Reflection about Yaxis&#xF097;(x&#x2019;,y&#x2019;)= My(x,y)&#xF097;x&#x2019;= -x&#xF097;y&#x2019;= y
• 48. Example&#xF097;Find the x&#x2019;y&#x2019;-coordinates of the xy points (10, 20)and (35, 20), as shown in the figure below:xy30x&#x2019;y&#x2019;1030&#xBA;(10, 20)(35, 20)
• 49. Example&#xF097;Find the x&#x2019;y&#x2019;-coordinates of the rectangle shownin the figure below:xy10x&#x2019;y&#x2019;1060&#xBA;20