01b18ea0645a705917ee99e858645762.ppt
- Количество слайдов: 21
2 D Translation Y 6 Note: House shifts position relative to origin 5 4 dx = 2 dy = 3 3 2 1 0 1 2 3 4 5 6 7 8 9 10 X 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 D 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
2 D Scaling Y 6 Note: House shifts position relative to origin 5 4 3 2 1 0 • • 1 2 3 4 5 6 7 8 9 10 X 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
2 D Rotation Y 6 Note: House shifts position relative to origin 5 4 3 2 1 0 • 1 2 3 4 10 X A 2 D rotation is applied 5 an object by 9 repositioning it along a circular to 6 7 8 path rotation by 0 angle, i. e. no rotation at all, gives us the identity matrix NB: A 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 x = r cos (f + q) y = r sin (f + q) www. Bookspar. com | Website for Students | VTU - Notes Question Papers x = r cos f y = r sin f
Rotation about fixed points Y 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 www. Bookspar. com | Website for Students | VTU - Notes Question Papers 10 X
2 D 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
2 D 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…
Reflection • Reflection produces a mirror image of an object • Mirror image for a 2 D 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
Shear • Shear distorts the shape • Helpful to add one more basic transformation • Equivalent to pulling opposite directions faces Consider simple shear along x axis x’ = x + y cot q y’ = y z’ = z H(q) = in
Homogenous Coordinates • Translation, scaling and rotation are expressed (nonhomogeneously) as: translation: scale: • • v’ = Sv rotation: • v’ = v + t v’ = Rv Composition is difficult to express – Translation is not expressed as a matrix multiplication Homogeneous coordinates allows expression of all three as 3 x 3 matrices for easy composition w is 1 for affine transformations www. Bookspar. com | Website for Students | VTU - Notes Question Papers
What is • ? P 2 d is intersection of line determined by Ph with the w = 1 plane W Ph (x, y, w) 1 P 2 d (x/w, y/w, 1) X • Infinite number of points correspond to (x, y, 1) : they Y constitute the whole line (tx, ty, tw) www. Bookspar. com | Website for Students | VTU - Notes Question Papers
2 D 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
2 D 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
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
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
Transformations are NOT Commutative Y 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 X Translation → Rotation Y 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 Rotation → Translation www. Bookspar. com | Website for Students | VTU - Notes Question Papers 9 10 X
3 D Basic Transformations (right-handed coordinate system) y x z • Translation • Scaling www. Bookspar. com | Website for Students | VTU - Notes Question Papers
3 D 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
Inverses of (2 D and) 3 D Transformations 1. Translation: 2. Scaling: 3. Rotation: 4. Shear: www. Bookspar. com | Website for Students | VTU - Notes Question Papers
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
THANK YOU www. Bookspar. com | Website for Students | VTU - Notes Question Papers


