1 / 35

Unit II Two-Dimensional Transformations :

Unit II Two-Dimensional Transformations :. CONTENTS:. Introduction to transformations. Transformation Matrix . Types of Transformations in Two-Dimensional Graphics Translation , Rotation ,Scaling. Reflection and Shear Transformations Rotation about an Arbitrary Point,

lynne
Télécharger la présentation

Unit II Two-Dimensional 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. Unit IITwo-Dimensional Transformations:

  2. CONTENTS: • Introduction to transformations. • Transformation Matrix. • Types of Transformations in Two-Dimensional Graphics • Translation, Rotation ,Scaling. • Reflection and Shear Transformations • Rotation about an Arbitrary Point, • Combined Transformation • Homogeneous Coordinates • 2D Transformations using Homogeneous Coordinates

  3. INTRODUCTION: • Almost all graphical systems allow the programmer to define the picture that include a variety of transformations. • E.g. A programmer is able to magnify a picture so that detail appears more clearly. Or reduce it so that more of the picture is visible. • The programmer is also able to rotate the picture so that he can see it in different angles. • What is geometric transformation? • Operations that are applied to the geometric description of an object to change its position, orientation, or size are called geometric transformations.

  4. Why do we need geometric transformations in CG( motivation )? • As a viewing aid • As a modeling tool • As an image manipulation tool

  5. 2D Transformation of Graphics

  6. So the geometric-transformation functions that are available in some system are following: • Translation • Rotation • Scaling • Other useful transforms includes: reflection and shear.

  7. 1. Two-Dimensional(2D) Translation :

  8. Two-Dimensional(2D) Translation: • We perform a translation on a single coordinate point by adding offsets to its coordinates so as to generate a new coordinate position. • Similarly, a translation is applied to an object that is defined with multiple coordinate positions by relocating all the coordinate positions by the same displacement along parallel paths. • Suppose tx and ty is the translation distances, (x, y) is the original coordinates, is the new coordinate position.

  9. Express the translation use matrix equation as following: • Translation is a rigid-body transformation that moves objects without deformation. • Ex: Translate a polygon with coordinates A(2, 5), B(7, 10), C(10, 2) by 3 units x direction and 4 units in y direction (Hint : Add 3 to all x values and 4 to all values).

  10. 2.Two-Dimensional Rotation:

  11. Two-Dimensional Rotation • We generate a rotation transformation of an object by specifying a rotation axis and a rotation angle. All points of the object are then transformed to new positions by rotating the points through the specified angle about the rotation axis. • A 2D rotation of an object is obtained by repositioning the object along a circular path in the xy plane, the rotation axis is perpendicular to the xy plane. • Parameters for 2D rotation is rotation angle and a rotation point( pivot point). • Rotation angle define a positive values for counterclockwise rotation about the pivot point.

  12. Diagram:

  13. r is the constant distance of the point form the origin, angle is the original angular position of the point from the horizontal, and is the rotation angle. (1) (2)

  14. (3) Put eq1 in eq 2:

  15. 3. Two-Dimensional(2D) Scaling: • Uniform Scaling • Un-uniform Scaling

  16. Two-Dimensional(2D) Scaling • To alter the size of an object, we apply a scaling transformation. A simple two-dimensional scaling operation is performed by multiplying object positions (x, y) by scaling factors sx and sy to produce the transformed coordinate . • Scaling factors sx scales an object in the x coordinate.

  17. Properties of the scaling transformation: • Any positive values can be assigned to the scaling factors sx and sy. • Values less then 1 reduce the size of object. • In contrast , enlarge the size of object. • When sx and sy are assigned to the same values, a uniform scaling is produced which maintains relative object proportions.

  18. Unequal values for sx and sy result in a differential scaling that is often used in design applications. • Negative values can also be specified for the scaling parameters, this not only resizes an object, it reflects the object one or more of the coordinate axis.

  19. 4.Reflection: Fig: Reflection about y axis • A reflection is a transformation that produces the mirror image of an object relative to an axis of reflection. • We can choose an axis of reflection in the xy plane or perpendicular to the xy plane.

  20. 5.Shear: • A transformation that slants the shape of an object is called as Shear transformation. • There are two types of transformations: • X shear • Y shear

  21. 1. X shear: • The X shear preserves the y coordinates but changes the x values which causes vertical line to tilt right or left as shown in the fig: (a)original object (b)Object after X shear

  22. The transformation matrix for X shear is given as X_sh= =x+.y and

  23. 2. Y shear: • The Y shear preserves the x coordinates, but changes the y values which causes horizontal line to transform into lines which slopes up or down as shown in the fig: • The transformation matrix for Y shear is given as Y_sh = =y+.x and

  24. Shearing relative to Other Reference line: • We can apply x shear and y shear transformations relative to other reference line. • In X shear transformation we can use y reference line and in Y shear we can use x reference line

  25. Homogeneous Coordinates: • In design and picture formation process, many times we may require to perform translation, rotation and scaling to fit the picture in their proper positions. • In fact, we can expressed three basic two-dimensional transformation( translation, rotation, and scaling) in the general matrix form:

  26. To produce a sequence of transformations such as translation followed by rotation and then scaling, we must calculate the transformed coordinates one step at a time. • First, coordinates are translated then these translated coordinates are scaled and finally scaled coordinates are rotated. But this process is not efficient. • A more efficient approach is to combine sequence of transformations into one transformation so that final coordinate positions are obtained directly from initial coordinates. • This eliminates the calculation of intermediate coordinate values.

  27. In order to combine sequence of transformations we have to eliminate the matrix addition associated with the translation terms in • To achieve this we have to represent this matrix as 3*3 matrix instead of 2*2 introducing an additional dummy coordinate W. • Here, points are specified by three numbers instead of two. • This coordinate system is called Homogeneous Coordinate System.

  28. The homogeneous coordinate is represented by a triplet(, , W). • Where, x= and y= • For 2Dtransformations we can have the homogeneous parameter W to be any non zero value. But it is convenient to have W=1. • Hence,2D position can be represented with homogeneous coordinate as (x,y,1).

  29. So, now we can say that the homogeneous coordinate allow combined transformation, eliminating the calculation of intermediate values and thus save required time for transformation and memory required to store intermediate coordinate values.

  30. Composition of 2DTransformation: • We have seen what is meant by combined or concatenated or composed transformation in the previous section. • The basic purpose of composing the transformation is to gain efficiency by applying a single composed transformation to a point rather than applying a series of transformations one after the other.

  31. Rotation about an Arbitrary Point: • To rotate an object about an arbitrary point(,),we have to carry out three steps: • Translate point (,) to the origin. • Rotate it about the origin and • Finally, translate the center of rotation back where it belongs.

  32. THANK U!!!!!!!!!!

More Related