1 / 21

2D Translation

6. 5. 4. Y. 3. 2. 1. dx = 2 dy = 3. 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. X. 2D Translation. Note: House shifts position relative to origin. A translation is applied to an object by repositioning

ronat
Télécharger la présentation

2D Translation

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. 6 5 4 Y 3 2 1 dx = 2 dy = 3 0 1 2 3 4 5 6 7 8 9 10 X 2D Translation Note: House shifts position relative to origin • A translation is applied to an object by repositioning it along a straight-line path from one coordinate location to another • Component-wise addition of vectors v’ = v + t where and x’ = x + dx y’ = y + dy To move polygons: translate vertices (vectors) and redraw lines between them • Preserves lengths (isometric) • Preserves angles (conformal) www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  2. 2D Translation • Rigid body transformation • Polygons are translated by adding the translation vector to the coordinate position of each vertex and generating the polygon using the new set of vertex coordinates • For circle and ellipse, translate the center coordinates and redraw the object in the new location • Translate the curves by (say, splines) displacing the coordinate positions defining the objects and redraw using translated points www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  3. 6 5 4 Y 3 2 1 0 1 2 3 4 5 6 7 8 9 10 X 2D Scaling Note: House shifts position relative to origin • The scaling alters the size of an object • Component-wise scalar multiplication of vectors v’ = Sv where and • Does not preserve lengths • Does not preserve angles (except when scaling is uniform) www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  4. 6 5 4 Y 3 2 1 0 1 2 3 4 5 6 7 8 9 10 X 2D Rotation • A 2D rotation is applied to an object by repositioning it along a circular path in the xy-plane • Rotation of vectors through an angle θ v’ = Rθv where and x’ = x cosθ – y sinθ y’ = x sinθ + y cosθ • Proof by double angle formula • Preserves lengths and angles Note: House shifts position relative to origin NB: A rotation by 0 angle, i.e. no rotation at all, gives us the identity matrix x = r cos (f + q) y = r sin (f + q) x = r cos f y = r sin f www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  5. 6 5 4 Y 3 2 1 0 1 2 3 4 5 6 7 8 9 10 X Rotation about fixed points www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  6. 2D Rotation • Rigid body transformation • Every point on the object is rotated with the same angle • Straight line segment is rotated by applying the rotation equations to line end points and redrawing with new end points • Polygons are rotated by displacing each vertex through the specified rotation angle and regenerating the polygon using new vertices • Curved lines are rotated by repositioning the defining points and redrawing the curves • Circle can be rotated about a non central axis by moving the center position through the arc that subtends the specified rotation angle • Ellipse can be rotated about its center coordinates by rotating the major and minor axes www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  7. 2D Rotation and Scale are Relative to Origin • Suppose object is not centered at origin • Solution: move to the origin, scale and/or rotate, then move it back. • Would like to compose successive transformations…

  8. Reflection • Reflection produces a mirror image of an • object • Mirror image for a 2D reflection is generated relative to an axis of reflection by rotating the object 180 degrees • corresponds to negative scale factors original sx = -1 sy = 1 sx = -1 sy = -1 sx = 1 sy = -1 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  9. Shear distorts the shape • Helpful to add one more basic transformation • Equivalent to pulling faces in opposite directions Shear Consider simple shear along x axis x’ = x + y cot q y’ = y z’ = z H(q) =

  10. Homogenous Coordinates translation: scale: rotation: v’ = v + t v’ = Sv v’ = Rv • Translation, scaling and rotation are expressed (non-homogeneously) as: • Composition is difficult to express • Translation is not expressed as a matrix multiplication • Homogeneous coordinates allows expression of all three as 3x3 matrices for easy composition • w is 1 for affine transformations www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  11. W Ph (x,y,w) 1 P2d (x/w,y/w,1) X Y What is ? • P2d is intersection of line determined by Ph with the w = 1 plane • Infinite number of points correspond to (x, y, 1) : they constitute the whole line (tx, ty, tw) www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  12. 2D Homogeneous CoordinateTransformations • For points written in homogeneous coordinates, translation, scaling and rotation relative to the origin are expressed homogeneously as: www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  13. 2D Homogeneous Coordinate Transformations • Consider the rotation matrix: • The 2 x 2 submatrix columns are: • unit vectors (length=1) • perpendicular (dot product=0) • vectors into which X-axis and Y-axis rotate (are images of x and y unit vectors) • The 2 x 2 submatrix rows are: • unit vectors • perpendicular • rotate into X-axis and Y-axis (are pre-images of x and y unit vectors) • Preserves lengths and angles of original geometry. Therefore, matrix is a “rigid body” transformation www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  14. Examples • Translate [1,3] by [7,9] • Scale [2,3] by 5 in the x direction and 10 in the Y direction • Rotate [2,2] by 90° www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  15. Matrix Compositions: Using Translation • Avoiding unwanted translation when scaling or rotating an object not centered at origin: • translate object to origin, perform scale or rotate, translate back. • How would you scale the house by 2 in “its” y and rotate it through 90°? • Remember: matrix multiplication is not commutative! Hence order matters www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  16. 6 6 5 5 4 4 Y Y 3 3 2 2 1 1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 X X Transformations are NOT Commutative Translation → Rotation Rotation → Translation www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  17. y x z 3D Basic Transformations (right-handed coordinate system) • Translation • Scaling www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  18. 3D Basic Transformations (right-handed coordinate system) • Rotation about X-axis • For rotation about x axis, x is unchanged • Rotation about Y-axis • For rotation about y axis, y is unchanged • Rotation about Z-axis • Rotation about z axis in three dimensions leaves all • points with the same z • Equivalent to rotation in two dimensions in planes of • constant z www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  19. Inverses of (2D and) 3D Transformations • Translation: • Scaling: • Rotation: • Shear: www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  20. References • Edward Angel –Interactive Computer Graphics • Hearn and Baker - Computer Graphics • James D. Foley - Computer Graphics: principles and practice • Asthana and Sinha- Computer Graphics • PPTs: Von Dom, Bing-Yu Chen www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

  21. THANK YOU www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

More Related