1 / 30

GEOMETRIC TRANSFORMATIONS

GEOMETRIC TRANSFORMATIONS. Review of Mathematical Preliminaries Points:. Vectors : directional lines. P 1 (x 1 ,y 1 ). P 0 (x 0 ,y 0 ). 1 . A vector has a direction and a length: Length: |V|=(x 2 + y 2 ) 1/2 A unit vector: |V| = 1 e.g.: Normalize a vector:

velvet
Download Presentation

GEOMETRIC TRANSFORMATIONS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GEOMETRIC TRANSFORMATIONS Review of Mathematical Preliminaries Points: • Vectors: directional lines P1(x1,y1) P0(x0,y0)

  2. 1. A vector has a direction and a length: Length: |V|=(x2 + y2)1/2 A unit vector: |V| = 1 e.g.: • Normalize a vector: 2. Add two vectors • 3. Scalar Multiplication

  3. V •  W , • 4. Dot product of two vectors scalar • V  W if  = 90 => cos = 0 => V  W = 0. • if  < 90 => cos > 0 => V  W > 0. • if  > 90 => cos < 0 => V  W < 0. • 5.Normal: a unit vector perpendicular to a surface

  4. . • Lines y = mx+b e.g.: y = x; ax+by+c=0 Let f(x,y) = ax + by + c A point p(xp,yp) is on the line if f(xp,yp) = 0. When b < 0: p(xp,yp) is above the line if f(xp,yp) < 0. p(xp,yp) is below the line if f(xp,yp) > 0. When b > 0: p(xp,yp) is above the line if f(xp,yp) > 0. p(xp,yp) is below the line if f(xp,yp) < 0.

  5. Parametric Form: P(t)=P0+t(P1-P0); 0 <= t <= 1 P1(x1,y1) P0(x0,y0) • P(t)=P0+t(P1-P0)

  6. Where, • x(t) = x0 + t * (x1 – x0) • y(t) = y0 + t * (y1 – y0) • 0 <= t <= 1 • x(t) = (1-t) * x0 + t * x1 • y(t) = (1-t) * y0 + t * y1 • 0 <= t <= 1

  7. 2D Transformations • Translate a point The algebraic representation of translation of point P(x,y) by D(dx,dy) is x’= x + dx y’= y + dy Its “matrix” representation is • Its logical representation is P’ = P + D • Its visual representation is P’ (x’,y’) P(x,y) D(dx,dy)

  8. Y Y 10 10 5 5 X X 0 0 5 5 10 10 (4,5) (7,5) (10,1) (7,1) Before Translation After Translation • To move a shape: translate every vertex of the shape

  9. Scaling (relative to the origin) Scale a point P(x,y) by S(sx,sy) Algebraic: x’=sx* x y’=sy* y Matrix: Logic: P’ = SP or P’ = S(sx,sy)P Scale a line P0P1 (scale each point) P0’=SP0 • P1’=SP1

  10. Y Y 10 10 5 5 X X 0 0 5 5 10 10 (4,5) (7,5) (2,5/4) (7/2,5/4) Before Scaling After Scaling • Scale a shape: scale every vertex of the shape. Visual representation Uniform Scaling:sx=sy

  11. (4.9, 7.8) (2.1, 4.9) (5,2) (9,2) Y Y Y Y Before Rotation After Rotation 10 10 10 10 5 5 5 5 X X X X 0 0 0 0 5 5 5 5 10 10 10 10 • Visual representation Before After Rotate a shape: rotate every vertex of the shape

  12. Summary • Translation: P’ = P + D • Scaling: P’ = S P • Rotation: P’ = R P Homogeneous Coordinates: P(x,y,w) (x,y) to (x,y,w) : (x,y,w) to (x,y)

  13. y’= y + dy w’=1 x’= x + dx • P’’ = T(dx2 , dy2)P’ • = T(dx2 , dy2) T(dx1 , dy1) P • = T(dx2+dx1, dy2+dy1) P

  14. Scaling P’=S(Sx, Sy)P • P’’ = S(Sx2 , Sy2)P’ • = S(Sx2 , Sy2)S(Sx1 , Sy1) P • = S(Sx2Sx1, Sy2Sy1)P

  15. Rotation • P’=R()P P’’=R(2)R(1)PP”=R(2+1)P

  16. Shear Transformation:SHx(a) and SHy(b) P’=SHx(a)P • Shear in x against y by a (or an angle). • x’ = x+ay • y’ = y w’=1

  17. P’=SHy(b)P • Shear in y against x by b (or an angle). • x’=x • y’=y + bx • w’=1.

  18. Y Y Y 10 10 10 5 5 5 X X X 0 0 0 5 5 5 10 10 10 Sheared in x Before Shear Sheared in y

  19. Rigid-body Transformation: T and R. • change: location, orientation; • not change: size, angle between elements. Affine Transformation: S, SH • change: size, location, angle; • not change: line (parallelism). • Note: uniform scaling is between the two. It changes size but not angle. • So far, our S, R, SH are all around the origin.

  20. y x After translation of P1 to origin y y P1  x x After rotation After translation to original P1 • Composition of 2D Transformation Rotate the house around P1 For every vertex (P) on the object: P’ = T(P1)R()T(-P1)P y

  21. y y y P1 x x x Original house P1 Translate P1 to origin Scale y y P2 x x Translate to final position P2 Rotate Scale and rotate the house around P1 and move it to P2

  22. For every vertex (P) on the object: P’ = T(P2) R()S(Sx,Sy)T(-P1)P. • Swap the order of operations:not permitted, except uniform scaling (sx=sy) can be swapped with rotation.

  23. y Maximum range of screen coordinates y Viewport 2 Window Viewport 1 x x World coordinates Window in world coordinates Window translated to origin Window scale to size of viewport Screen coordinates Translated by (u,v) to final position y y Window Window x x Screen coordinates World coordinates 5.4 Window-to-Viewport Transformation world-coordinate: inches, feet etc & screen-coordinate: pixels

  24. y x z • Matrix Representation of 3D Transformation Translation: Scaling:

  25. Rotation, around Z-axis: Rotation, around X-axis: Rotation, around Y-axis:

  26. P( x, y, z ) x xp P’(xp, yp, zp) z d z (0,0,0) Projection Plane (View Plane) Projection: Project 3D objects on to a 2D surface

  27. xp= x’ / w’ = x / (z/d + 1) • yp= y’ / w’ = y / (z/d + 1)

  28. P1 P2 P’1 z P’2 Foreshortening: The size of the projected object becomes smaller when the object moves away from the eye. Perspective Projection: the projection that has the foreshortening effect.

  29. 0 Parallel Projection: d  , lines of sight become parallel P1 0 z P2 View Plan (0,0,0)

  30. 0

More Related