Presentation is loading. Please wait.

Presentation is loading. Please wait.

8. 2D Coordinate Operations Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze.

Similar presentations


Presentation on theme: "8. 2D Coordinate Operations Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze."— Presentation transcript:

1 8. 2D Coordinate Operations e-mail: Assoc.Prof.Dr. Ahmet Zafer Şenalp e-mail: azsenalp@gmail.comazsenalp@gmail.com Mechanical Engineering Department Gebze Technical University ME 521 Computer Aided Design

2 Introduction Many of the engineering problems are solved by defining the model in 2D. Within these problems;  Standard kinematics problems  Some mechanism movements  Shear force bending moment graphics of structural members can be listed. For the representation of these problems basic graphics elements such as line, circle are needed. Additionally transformations should be applied to the basic graphics elements to obtain the desired graphical view. Fundamental operations in graphics work can be summarized as follows:  Translation  Rotation  Scaling Dr. Ahmet Zafer Şenalp ME 521 2 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

3 Translation: A translation is moving every point a constant distance in a specified direction. It is one of the rigid motions.rigid motions Mathematically; x' = x + Tx y' = y + Ty Here; x y : initial coordinates x' y' : final coordinates. Dr. Ahmet Zafer Şenalp ME 521 3 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

4 A triangle is given below with [(20,0) (60,0) (40,100)] vertex coornitaes This triangle is translated 100 units to right 10 units to up; Tx = 100, Ty = 10 and x' = x + Tx y' = y + Ty The new vertex coordinates of the triangle is: [(120,10) (160,10) (140,110)] Öteleme örneği Dr. Ahmet Zafer Şenalp ME 521 4 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

5 Rotation: A point (x,y) is rotated in counter clockwise direction around the center of the coordinate axis. The new coordinates can be calculated as follows: ( PS: Obeying to the right hand rule counter clockwise direction is taken to be positive.) x = r cos  y = r sin  x’ = r cos (  +  ) = r ( cos  cos  - sin  sin  ) = r cos  cos  - r sin  sin  = x cos  - y sin  y’ = r sin (  +  ) = r ( sin  cos  + cos  sin  ) = r sin  cos  + r sin  cos  = x sin  + y cos  As a result: x’ = x cos  - y sin  y’ = x sin  + y cos  İs obtained. P(x,y) noktasının saat yönünün tersi yönünde  açısıyla döndürülmesi Dr. Ahmet Zafer Şenalp ME 521 5 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

6 The triangle given in translation example with initial coordinates [(20,0) (60,0) (40,100)] is rotated around the coordinat system’s center in clock wise direction with an angle of 45 degrees. The new coordinates of the triangle are: PS: These equations are used for the rotation about center point O only. Dr. Ahmet Zafer Şenalp ME 521 6 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

7 Scaling: To change the scale of an object x' = x Sx y' = y Sy equations are used. Dr. Ahmet Zafer Şenalp ME 521 7 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

8 Given the triangle with vertex coordinates [(20,0) (60,0) (40,100)] Calculate the new coordinates when the size of the triangle is scaled by 2 Sx = Sy =2 New coordinates are calculated to be: (40,0) (120,0) (80,200) Dr. Ahmet Zafer Şenalp ME 521 8 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

9 PS: When Sx and Sy are used with different magnitudes the image will be distorted. By using scaling mirror images shown below can be obtained. Dr. Ahmet Zafer Şenalp ME 521 9 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

10 Sequential transformations can be concatenated. As an example a rotation about an arbitrary point can be written as: translation + rotation + translation The mentioned sequence is important. Example: A body; 1.Rotated about coordinate system’s center 90 degrees counter clock wise 2.Translated -80 units in x direction (Tx = - 80, Ty = 0); İs obtained. If operation sequence is changed different result will be obtained. Concatenation is prefered as less arithmetic operation is necessary. Rotationx' = yTranslationx'' = x' - 80 y' = -xy'' = y' Concatenationx'' = y - 80 y'' = -x or Dr. Ahmet Zafer Şenalp ME 521 10 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

11 2D transfomations can be conducted by using a 3 x 3 matrix (x, y) coordinates are transformed to ( x', y‘): addition of units to the [ x, y ] vector enables it to be transformed by the 3 x 3 matrix Dr. Ahmet Zafer Şenalp ME 521 11 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

12 Translation: Rotation: Scaling: Dr. Ahmet Zafer Şenalp ME 521 12 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

13 Consider scaling Sx = Sy = 2, then translate it with Tx = 10, Ty = 0 Scaling: Translate: Dr. Ahmet Zafer Şenalp ME 521 13 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

14 The result [ x' y' 1] is merely an intermediate one and we can eliminate it by subtituting the first equation into the second: The two 3 x 3 matrices are independent of the ( x, y ) points being transformed, and are derived only from the parameters specified in the transformation sequence ( Sx, Sy, Tx, Ty). Therefore the product of the two matrices can be used. Thus the product of two matrix transformations represents the concatenation of those transforms. Irrespective of the number of transformation, we can always concatenate so that one 3 x 3 matrix represents the entire sequence. Dr. Ahmet Zafer Şenalp ME 521 14 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

15 Suppose we wish to derive a transformation which will rotate a point through a clockwise angle about a point (Px, Py). 1.The rotation transformation can be applied to rotate points about the origin. Therefore we must first translate points so that (Px, Py) becomes the origin: 2.Then rotation is applied. Dr. Ahmet Zafer Şenalp ME 521 15 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

16 3.And finally we translate the point so that the origin is returned to (Px, Py): These operations may be concatenated: If Px, Py and are known three matrices can be multiplied to yield one transformation matrix Dr. Ahmet Zafer Şenalp ME 521 16 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

17 When generating a picture for display, we may need to apply a transformation to a large number of points. This application must be as efficient as possible. the computation seems at a first glance to require 9 multiplications and 6 additions. However, in the formulation given here, the third column of the 3 x 3 matrix will always be: even if the matrix is result of many concatenations, the computations for x' and y' reduces to: x' = ax + by +c y' = dx + ey +f which reduces to 4 multiplications and 4 additions. Dr. Ahmet Zafer Şenalp ME 521 17 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations

18 A matrix rotation for this abbreviated computation is: The transformation matrix is now a 3 x 2 matrix. However we cannot concatenate two 3 x 2 matrices by multiplying them together: before we multiply them we must first return them to 3 x 3 form by attaching a third column. Dr. Ahmet Zafer Şenalp ME 521 18 Mechanical Engineering Department, GTU 8. 2D Coordinate Operations


Download ppt "8. 2D Coordinate Operations Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze."

Similar presentations


Ads by Google