2D Geometric Transformations

Reviews
Shared by: Manuel Arce Garcia
Stats
views:
2475
rating:
9(1)
reviews:
0
posted:
12/10/2007
language:
English
pages:
0
2D Geometric Transformations (Chapter 5 in FVD) 1 2D geometric transformation • • • • • • • Translation Scaling Rotation Shear Matrix notation Compositions Homogeneous coordinates 2 2D Geometric Transformations • Question: How do we represent a geometric object in the plane? • Answer: For now, assume that objects consist of points and lines. A point is represented by its Cartesian coordinates: (x,y). • Question: How do we transform a geometric object in the plane? • Answer: Let (A,B) be a straight line segment and T a general 2D transformation: T transforms (A,B) into another straight line segment (A’,B’), where A’=TA and B’=TB. 3 Translation • Translate (a,b): (x,y) (x+a,y+b) Translate(2,4) 4 Scale • Scale (a,b): (x,y) (ax,by) Scale (2,3) Scale (2,3) 5 • How can we scale an object without moving its origin (lower left corner)? Translate(-1,-1) Translate(1,1) Scale(2,3) 6 Reflection Scale(-1,1) Scale(1,-1) 7 Rotation • Rotate(θ): (x,y) (x cos(θ)+y sin(θ), -x sin(θ)+y cos(θ)) Rotate(90) Rotate(90) 8 • How can we rotate an object without moving its origin (lower left corner)? Translate(-1,-1) Translate(1,1) Rotate(90) 9 Shear • Shear (a,b): (x,y) Shear(1,0) (x+ay,y+bx) Shear(0,2) 10 Composition of Transformations • Rigid transformation: – Translation + Rotation (distance preserving). • Similarity transformation: – Translation + Rotation + uniform Scale (angle preserving). • Affine transformation: – Translation + Rotation + Scale + Shear (parallelism preserving). • All above transformations are groups where Rigid ⊂ Similarity ⊂ Affine. 11 Affine Similarity Rigid 12 Matrix Notation • Let’s treat a point (x,y) as a 2x1 matrix (a column vector): x   y   • What happens when this vector is multiplied by a 2x2 matrix? a b   x  ax + by   c d   y  =  cx + dy       13 2D Transformations • 2D object is represented by points and lines that join them. • Transformations can be applied only to the the points defining the lines. • A point (x,y) is represented by a 2x1 column vector, and we can represent 2D transformations using 2x2 matrices:  x '  a b   x  =  y ' c d   y       14 Scale • Scale(a,b): (x,y) (ax,by) a 0  x  ax   0 b  y  = by       • If a or b are negative, we get reflection. • Inverse: S-1(a,b)=S(1/a,1/b) 15 Reflection • Reflection through the y axis:  − 1 0  0 1   • Reflection through the x axis:  1 0 0 −1   • Reflection through y=x: 0 1 1 0    • Reflection through y=-x:  0 − 1  − 1 0   16 Shear, Rotation • Shear(a,b): (x,y) (x+ay,y+bx) 1 a   x   x + ay  b 1   y  =  y + bx       • Rotate(θ): (x,y)  cosθ  − sin θ  (xcosθ+ysinθ , -xsinθ + ycosθ) sin θ   x   x cosθ + y sin θ    y  =  − x sin θ + y cosθ  cosθ      • Inverse: R-1(θ)=RT(θ)=R(-θ) 17 Composition of Transformations • A sequence of transformations can be collapsed into a single matrix:  x  x [ A][B ][C ]  = [D ]   y  y • Note: order of transformations is important! (otherwise - commutative groups) translate rotate rotate translate 18 Composition of Transformations (Cont.) D=ABC D-1 = C-1B-1A-1 Proof: D * D-1 = ABC * C-1B-1A-1 = AB*I*B-1*A-1= A*I*A = I 19 Translation  x  x + a • Translation(a,b):   →  y   y + b   • Problem: Cannot represent translation using 2x2 matrices. • Solution: Homogeneous Coordinates 20 Homogeneous Coordinates • Homogeneous Coordinates is a mapping from Rn to Rn+1: (x, y) →( X,Y,W) = (tx, ty, t) • Note: (tx,ty,t) all correspond to the same non-homogeneous point (x,y). E.g. (2,3,1)≡(6,9,3). • Inverse mapping: X Y  ( X , Y ,W ) →  ,  W W  21 Translation • Translate(a,b): 1 0 a   x   x + a  0 1 b   y  =  y + b       0 0 1   1   1       • Inverse: T-1(a,b)=T(-a,-b) • Affine transformation now have the following form: a b c d  0 0  22 e f  1  Geometric Interpretation W Y (X,Y,W) 1 y x (X,Y,1) X • A 2D point is mapped to a line (ray) in 3D. The non-homogeneous points are obtained by projecting the rays onto the plane Z=1. 23 • Example: Rotation about an arbitrary point: (x0,y0) θ • Actions: – Translate the coordinates so that the origin is at (x0,y0). – Rotate by θ. – Translate back.  1 0 x0   cosθ 0 1 y  − sinθ 0   0 0 1  0   cosθ =  sinθ   0  − sinθ cosθ 0 sinθ cosθ 0 0 1 0 − x0   x  0  0 1 − y 0   y  =    1  0 0 1   1     x0 (1− cosθ ) + y0 sinθ   x  y0 (1− cosθ ) − x0 sinθ   y     1  1   24 • Another example: Reflection about an Arbitrary Line: p2 p1 L=p1+t (p2-p1)=t p2+(1-t) p1 • Actions: – Translate the coordinates so that P1 is at the origin. – Rotate so that L aligns with the xaxis. – Reflect about the x-axis. – Rotate back. – Translate back. 25 Change of Coordinates • It is often requires the transformation of object description from one coordinate system to another. • How do we transform between two Cartesian coordinate systems? • Rule: Transform one coordinate frames towards the other in the opposite direction of the representation change. r Rep n tatio esen y’ x’ y x 26 n atio rm nsfo Tra Change of Coordinates (Cont.) Example: X P’ O Y X’ P O’ Y’ 27 • Example: – Represent the point P=(xp,yp,1) in the (x’,y’) coordinate system. P '= MP where  cos θ  −1 −1 M = R T =  sin θ  0  y’ θ − sin θ cos θ 0 0  1 0 − x0    0  0 1 − y0  1  1  0 0   y x’ (x0,y0) (xp,yp) x 28 • Alternative method: – Assume x’=(ux,uy) and y’=(vx,vy) in the (x,y) coordinate system . P '= MP where  ux  M =  vx 0  uy vy 0 0  1 0 − x0    0  0 1 − y0  1  0 0 1    y’ (ux,uy) y (vx,vy) x’ (x0,y0) x 29 • Example: – P is at the y’ axis P=(vx,vy): y (vx,vy) (ux,uy) y’ x’ x ux  P' = MP =  v x 0  uy vy 0 0  v x   0      0  v y  = 1  1   1 1     – What is the inverse? 30 • Another example: Reflection about an Arbitrary Line: y p1 p2 x • Define a coordinate systems (u,v) parallel to P1P2: p 2 − p1  u x  u= ≡  p 2 − p1  u y   − u y   vx  v=  = v   ux   y   1 0 p1x  u x   M =  0 1 p1y  u y  0 0 1  0   vx vy 0 0  1 0 0  u x   0  0 − 1 0  v x   1 0 0 1 0   31 uy vy 0 0  1 0 − p1x    0  0 1 − p1y  1 0 0 1   

Shared by: Manuel Arce Garcia
Other docs by Manuel Arce G...
FPGA Tutorial with SPARTAN 3
Views: 2836  |  Downloads: 121
JMF guide
Views: 1097  |  Downloads: 45
biblia de los trucos para windows e internet
Views: 5730  |  Downloads: 386
Apuntes de analisis numerico
Views: 5461  |  Downloads: 353
manual de matlab 7 0 español
Views: 36493  |  Downloads: 1783
criptografia y seguridad
Views: 4347  |  Downloads: 227
criptografia-matematicas
Views: 2254  |  Downloads: 158
norma rs232
Views: 4022  |  Downloads: 108
cienematica de un robot
Views: 2132  |  Downloads: 85
topologia
Views: 423  |  Downloads: 6
Teoria y praxis - EMMANUEL KANT
Views: 3104  |  Downloads: 21
Romero y julieta - Willian Shakespeare
Views: 2539  |  Downloads: 13
Procesos Elementales En Una Computadora Cuantica
Views: 1514  |  Downloads: 13
Politica - Aristoteles
Views: 826  |  Downloads: 12
Related docs
2D
Views: 96  |  Downloads: 16
2D CAD
Views: 29  |  Downloads: 0
Transformations of the plane
Views: 2  |  Downloads: 0
Geometric Modeling Project 1 Report
Views: 3  |  Downloads: 1
3D transformations
Views: 530  |  Downloads: 57
Unit 2D Josephs coat
Views: 1  |  Downloads: 0
3D Geometric Shapes
Views: 4056  |  Downloads: 13
CERTIFICATE COURSE IN 2D ANIMATION
Views: 10  |  Downloads: 2
Computer Graphics Geometric Modeling
Views: 0  |  Downloads: 0