Your SlideShare is downloading. ×
0
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Two dimentional transform
Upcoming SlideShare
Loading in...5
×

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.
Text the download link to your phone
Standard text messaging rates apply

Two dimentional transform

850

Published on

2D transformation

2D transformation

Published in: Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

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

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TransformationAn operation that changes one configuration intoanotherTypes of Transformation:Geometric transformation Object itself is transformed relative to a stationary co-ordinateCo-ordinate transformation Co-ordinate system is transformed relative to an object. Object is held stationary
  • 2. 2D Geometric Transformations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).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One of rigid-body transformation, which move objects withoutdeformationTranslate an object by Adding offsets to coordinates to generatenew coordinates positionsSet tx, ty be the translation distance, we haveP’=P+TTranslation moves the object without deformationPP’Txtxx += ytyy +==yxP =yxttT=yxP
  • 5. Basic 2D TranslationTo move a line segment, apply thetransformation equation to each of the twoline endpoints and redraw the line betweennew endpoints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Object is rotated ϴ° about the origin.ϴ > 0 – rotation is counter clock wiseϴ < 0 – rotation is clock wise6πθ =yx011223 4 5 6 7 8 9 103456
  • 8. 2-D Rotationx = r cos (φ)y = r sin (φ)x’ = r cos (φ + θ)y’ = r sin (φ + θ)Trig Identity…x’ = r cos(φ) cos(θ) – r sin(φ)sin(θ)y’ = r sin(φ) sin(θ) + r cos(φ)cos(θ)Substitute…x’ = x cos(θ) - y sin(θ)y’ = x sin(θ) + y cos(θ)θ(x, y)(x’, y’)φ
  • 9. Basic 2D Geometric Transformations2D Rotation matrixP’=R·PΘΘΘ−Θ=cossinsincosRΦΦ(x,y)rr θ(x’,y’) −=yxyxθθθθcossinsincos
  • 10. Basic 2D Geometric Transformations2D RotationRotation for a point about any specifiedposition (xr, yr)x’=xr+(x - xr) cos θ – (y - yr) sin θy’=yr+(x - xr) sin θ + (y - yr) cos θ
  • 11. Rotations also move objects withoutdeformationA line is rotated by applying the rotationformula to each of the endpoints and redrawingthe line between the new end pointsA polygon is rotated by applying the rotationformula to each of the vertices and redrawingthe polygon using new vertex coordinates
  • 12. ExampleA point (4,3) is rotatedcounterclockwise by an angle 45°find the rotation matrix andresultant point.
  • 13. Basic 2D Geometric Transformations2D ScalingScaling is the process of expanding or compressingthe dimension of an objectSimple 2D scaling is performed by multiplying objectpositions (x, y) by scaling factors sx and syx’ = x · sxy’ = y · sy⋅=yxssyxyx00P(x,y)P’(x’,y’)xsx• xsy• yy
  • 14. 2D ScalingAny positive value can beused as scaling factor Sf < 1 reduce the size of theobject Sf > 1 enlarge the object Sf = 1 then the object staysunchanged If sx= sy, we call it uniformscaling If scaling factor <1, then theobject moves closer to theorigin and If scaling factor >1,then the object moves fartherfrom the originyx011223 4 5 6 7 8 9 10345612133639
  • 15. Basic 2D Geometric Transformations2D ScalingWe can control the location of the scaled object bychoosing a position called the fixed point (xf, yf)x’ – xf = (x – xf) sx y’ – yf = (y – yf) syx’=x · sx+ xf (1 – sx)y’=y · sy+ yf (1 – sy)Polygons are scaled by applying the above formula toeach vertex, then regenerating the polygon using thetransformed vertices
  • 16. Example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Expand each 2D coordinate (x, y) to three elementrepresentation (xh, yh, h) called homogenouscoordinatesh is the homogenous parameter such thatx = xh/h, y = yh/h,A convenient choice is to choose h = 1
  • 18. Homogeneous Coordinates for translation2D Translation Matrixor, P’ = T(tx,ty)·P⋅=110010011yxttyxyx
  • 19. Homogeneous Coordinates forrotation2D Rotation Matrixor, P’ = R(θ)·P⋅ΘΘΘ−Θ=11000cossin0sincos1yxyx
  • 20. Homogeneous Coordinates for scaling2D Scaling Matrixor, P’ = S(sx,sy)·P⋅=110000001yxssyxyx
  • 21. Inverse Transformations2D Inverse Translation Matrix−−=−10010011yxttT
  • 22. Inverse Transformations2D Inverse Rotation MatrixΘΘ−ΘΘ=−1000cossin0sincos1R
  • 23. Inverse Transformations2D Inverse Scaling Matrix=−1000100011yxssS
  • 24. 2D Composite TransformationsWe can setup a sequence of transformations asa composite transformation matrix bycalculating the product of the individualtransformationsP’=M2·M1·PP’=M·P
  • 25. 2D Composite TransformationsComposite 2D Translations++=⋅10010011001001100100121211122yyxxyxyxtttttttt
  • 26. 2D Composite TransformationsComposite 2D RotationsΘ+ΘΘ+ΘΘ+Θ−Θ+Θ=ΘΘΘ−Θ⋅ΘΘΘ−Θ1000)cos()sin(0)sin()cos(1000cossin0sincos1000cossin0sincos2121212111112222
  • 27. 2D Composite TransformationsComposite 2D Scaling⋅⋅=⋅10000001000000100000021211122yyxxyxyxssssssss
  • 28. −−+−−=−−⋅ −⋅100sin)cos1(cossinsin)cos1(sincos10010011000cossin0sincos1001001θθθθθθθθθθθθrrrrrrrrxyyxyxyx( ) ( ) ( ) ( )θθ ,,,, rrrrrr yxRyxTRyxT =−−⋅⋅Translate Rotate Translate(xr,yr)(xr,yr)(xr,yr)(xr,yr)
  • 29. −−=−−⋅⋅100)1(0)1(0100100110000001001001yfyxfxffxffsyssxsyxssyxyTranslate Scale Translate(xr,yr)(xr,yr)(xr,yr)(xr,yr)( ) ( ) ( ) ( )yxffffyxff ssyxSyxTssSyxT ,,,, ,, =−−⋅⋅
  • 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• I started my car and drove 5m forward, turned 30degrees to right, moved 5m forward again, andturned 45 degrees to the right, and stopped• What is the position of the side mirror now,relative to where I was sitting in the beginning?
  • 32. Other Two Dimensional TransformationsReflectionTransformation that produces a mirrorimage of an objectImage is generated relative to an axis ofreflection by rotating the object 180°about the reflection axis
  • 33. Reflection about the line y=0 (the x axis)−100010001
  • 34. Reflection about the line x=0 (the y axis)−100010001
  • 35. Reflection about the origin−−100010001
  • 36. Reflection when x = y
  • 37. Example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Transformation that distorts the shape of anobject is called shear transformation.Two shearing transformation used: Shift X co-ordinates values 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10001001 xshyyyshxx x=⋅+=Preserve Y coordinates but change the X coordinates values
  • 40. Y shearPreserve X coordinates but change the Y coordinates valuesx’ = xy’ = y + Shy . xyx(0,1) (1,1)(1,0)(0,0)yx(0,1)(1,2)(1,1)(0,0)10001001ysh
  • 41. Example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X shear with reference to Y axisxy11yref = -1xshx = ½, yref = -111 2 3yref = -1( )x refx x sh y yy y′ = + −′ =10 1 01 0 0 1 1x x refx sh sh y xy y′ − ×     ÷  ÷ ÷′ = ÷  ÷ ÷ ÷  ÷ ÷    
  • 43. Shear relative to other axisY shear with reference to X axis( )y refx xy y sh x x′ =′ = + −1 0 011 0 0 1 1x y refx xy sh sh x y′     ÷  ÷ ÷′ = − × ÷  ÷ ÷ ÷  ÷ ÷    xy11xref = -1yx112xref = -1
  • 44. ExampleApply shearing transformation to square withA(0,0), B(1,0), C(1,1), D(0,1).Shear parameter value is 0.5 relative to lineYref = - 1 and Xref = - 1
  • 45. 321321321 M)MM()MM(MMMM ⋅⋅=⋅⋅=⋅⋅Associative propertiesTransformation is not commutative (CopyCD!)Order of transformation may affect transformationpositionMatrix Concatenation Properties
  • 46. Transformations between 2DTransformations between 2DCoordinate SystemsCoordinate SystemsTo translate object descriptions from xy coordinates to x’y’coordinates, we set up a transformation that superimposesthe x’y’ axes onto the xy axes. This is done in two steps:1. Translate so that the origin (x0, y0) of the x’y’ system ismoved to the origin (0, 0) of the xy system.2. Rotate the x’ axis onto the x axis.xyx0x’y’y0θ
  • 47. Translation(x’,y’)=Tv(x,y)x’= x – txy’=y-tyRotation about origin(x’,y’)=Rϴ(x,y)x’= xcosϴ + ysinϴy’= -xsinϴ + ycosϴScaling with origin(x’, y’)=Ssx, sy(x,y)x’= (1/sx)xy’= (1/sy)yReflection about Xaxis(x’,y’)= Mx(x,y)x’= xy’= -yReflection about Yaxis(x’,y’)= My(x,y)x’= -xy’= y
  • 48. ExampleFind the x’y’-coordinates of the xy points (10, 20)and (35, 20), as shown in the figure below:xy30x’y’1030º(10, 20)(35, 20)
  • 49. ExampleFind the x’y’-coordinates of the rectangle shownin the figure below:xy10x’y’1060º20

×