Presentation is loading. Please wait.

Presentation is loading. Please wait.

COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 2D Geometric Transformations Graphics Systems.

Similar presentations


Presentation on theme: "COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 2D Geometric Transformations Graphics Systems."— Presentation transcript:

1 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS D Geometric Transformations Graphics Systems / Computer Graphics and Interfaces

2 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS D Geometric Transformations The geometric transformations in computer graphics are essential to position, change the orientation and scale objects in the scene created. The movement is also implemented by the processing parameters vary over time. Transformations: Translation Scaling Rotation

3 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Translation Vertices: (4,5) and (7,5) T x T = 3 y = -4 x T = X + T x y T = Y + T y The pair of translation is called for translation vector. Each vertex is assigned a displacement T: In the form of matrix product:

4 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Scaling x T = X * S x y T * Y = S y Regarding the origin. 100 S x = 2 S y = S x = 2 S y = -1.5

5 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Scaling In matrix form: Scale Factor: > Increase the subject 1 <1 reduces the object s x = S y Uniform scaling factor  does not distort the object

6 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Rotation x, y b thethe x = R.cos (a) y = R.sen (a) 100 xRYRxRYR R x R R.cos = (a + b) = R.cos (a). Cos (b) - R.sen (a). Sin (b) = x.cos (b) - y.sen (b) y R R.sen = (a + b) = R. Sin (b).cos (a) + R.sen (a). Cos (b) = x.sen (b) + y.cos (b) Around the origin. Obtains a new position on the previous and the relative angle of rotation. Vertices: (20.0) (60.0) (40,100) Rotation of -45 Vertices: (14:14, ), (42.43, ), (98.99, 42.43)

7 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Rotation In matrix form: Note: b positive movement in the opposite clockwise direction. +

8 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Composition of Transformations The application of a sequence of operations = 1 single transformation T1 T2 T3 Tc

9 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Composition of Transformations Initial situation (20.0) (60.0) (40,100) After rotation (0, -20) (0, -60) (100, -40) a = - 90 ° After translation (-80, -20) (-80, -60) (20, -40) Tx = -80, Ty = Replacing the transformations: Initial situation (20.0) (60.0) (40,100) After translation (-60.0) (-20.0) ( ) Tx = -80, Ty = 0 After rotation (0.60) (0.20) (100.40) a = - 90 ° Conclusion: The application of the transformations is not commutative

10 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Homogeneous coordinates The previous sequence, rotation, translation then applied to each vertex can be written as: 1 If the matrices representing the transformations were of the same size would be able to combine. 2 However, the above transformations can also be written as (homogeneously) We can then write: The matrix product is: Associative In general Noncommutative

11 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Homogeneous coordinates - summary Rotation MatrixMatrix Translation Escalation Matrix In homogeneous coordinates of an object n dimensions is represented in space n +1 dimensions. (X, y)  (x.h, y.h h) 2D 3D We consider h = 1

12 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Transformations - Examples T (d x2, D y2 ) * T (d x1, D y1 ) = T (d x1 + D x2, D y1 + D y2 ) T (d x1, D y1 ) T (d x2, D y2 ) T (?,?) P P ' P'' P '= T (d x1, D y1 ) * P R'' = T (d x2, D y2 ) * P ' R'' = T (d x2, D y2 ) * T (d x1, D y1 ) * P Check that: O (s x2, S y2 ) S * (s x1, S y1 ) S = (s x1 * S x2, S y1 * S y2 ) R (the 2 ) * R (the 1 ) = R (a 2 + A 1 )

13 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Transformations on a arbitrary point (pivot) Rotation Rotation of -45 The rotation moves objects around the origin. Solution: Traverse the object so that the point Anchorman coincides with the origin Rotating the object around the origin Making the translation of the object so that the point Anchorman return to starting position (inverse of first)

14 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Transformations on a arbitrary point (pivot) Transformation matrix Scaling Traverse the object so that the point Anchorman coincides with the origin Climb the object Making the translation of the object so that the point Anchorman return to starting position (inverse of first)

15 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Exercise Determine the transformation matrix for: T (-x1,-y1) S (0.5,0.5) R (90)T (x2, y2) If P 1 = (1,2) and P 2 = (3.3) determine the matrix of equivalent transformation.

16 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Other transformations Reflection In relation to axis x corresponds to a 180 ° rotation in 3D space around the axis of reflection, which results in a scaling S (1, -1) In relation to axis y: y x x y

17 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Other transformations x y Reflection relative to the line y = x Reflection relative to the line y =- x x y

18 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Inverse Transformations If a transformation possibly composite is given by a matrix Mdimensions of 3x3, then the inverse transformation that puts the object in its initial position (ie no transformation) is given by M -1. Once M represents one or more transformations, the inverse matrix should be. M.M -1 = I For some transformations is easy to find the inverse matrix: Translation: Scaling:

19 COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Exercise (Question of the May 23, 2002 test)


Download ppt "COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2004 1 2D Geometric Transformations Graphics Systems."

Similar presentations


Ads by Google