Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dx = 2 dy = 3 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 2D Translation A translation is applied to an object by repositioning it along a straight-line path.

Similar presentations


Presentation on theme: "Dx = 2 dy = 3 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 2D Translation A translation is applied to an object by repositioning it along a straight-line path."— Presentation transcript:

1 dx = 2 dy = 3 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 2D Translation 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 Note: House shifts position relative to origin

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 2D Scaling 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 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 Note: House shifts position relative to origin

4 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 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 NB: A rotation by 0 angle, i.e. no rotation at all, gives us the identity matrix Note: House shifts position relative to origin x = r cos (  y = r sin (  x = r cos  y = r sin 

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

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 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers 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 s x = -1 s y = 1 s x = -1 s y = -1s x = 1 s y = -1

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

10 Homogenous Coordinates 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 translation: scale: rotation: v’ = v + t v’ = Sv v’ = Rv

11 What is ? P 2d is intersection of line determined by P h 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 P 2d (x/w,y/w,1) P h (x,y,w) Y X W 1

12 2D Homogeneous Coordinate Transformations 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 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 Y X 0 1 1 2 2 3 4 5 6 7 8 9 3 4 5 6 Translation → Rotation Rotation → Translation Transformations are NOT Commutative www.Bookspar.com | Website for Students | VTU - Notes - Question Papers

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

18 3D Basic Transformations Rotation about X-axis www.Bookspar.com | Website for Students | VTU - Notes - Question Papers (right-handed coordinate system) Rotation about Y-axis Rotation about Z-axis For rotation about x axis, x is unchanged For rotation about y axis, y is unchanged 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

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

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


Download ppt "Dx = 2 dy = 3 Y X 0 1 1 2 2 3 4 5 6 7 8 9 10 3 4 5 6 2D Translation A translation is applied to an object by repositioning it along a straight-line path."

Similar presentations


Ads by Google