Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transformations. Content Coordinate systems 2D Transformations 3D Transformations Transformation composition Rotating about a pivot Rotating about an.

Similar presentations


Presentation on theme: "Transformations. Content Coordinate systems 2D Transformations 3D Transformations Transformation composition Rotating about a pivot Rotating about an."— Presentation transcript:

1 Transformations

2 Content Coordinate systems 2D Transformations 3D Transformations Transformation composition Rotating about a pivot Rotating about an axis Agradecimientos: A Alex García-Alonso por facilitar el material para la realization de estas transparencias (http://www.sc.ehu.es/ccwgamoa/clases)

3 Coordinate systems An object is represented by polygons A polygon is a collection of vertex and edges To transform an object we must transform their vertex From local system to the global system: transformations

4 2D Transformations Translation Scale Rotation Deformation

5 2 dimensions: translation x´10t x x y´01t y y x´=x+t x y´=y+t y

6 2 dimensions: scale x´= s x ·x y´= s y ·y x´ s x 00 x y´0 s y 0 y

7 2 dimensions: rotation x = r cos  y = r sen  x’ = r cos (  +  ) = = r (cos  cos  – sen  sin  ) = = x cos  – y sen  y’ = r sen (  +  ) = = r ( cos  sen  + sen  cos  ) = = x sin  + y cos  P P’ x y   x’ y’ r

8 2 dimensions: rotation Matricially representation with Homogenous coordinates: x´ cos β -sin β 0 x y´ sin β cos β0y

9 2 dimensions: deformation (shear) Deformation of x coordinate: x´ 1 h x 0 x y´ 0 10y x´=x+h x ·y y´=y

10 3D Transformations The general expression of a 3D transformation in Homogenous coordinates: x´a 11 a 12 a 13 a 14 x y´a 21 a 22 a 23 a 24 y z´a 31 a 32 a 33 a 34 z

11 Transformation Matrix M 44 Describe all the transformations: translation, scale, rotation, deformation. The composition of transformations is made by the product of matrix You can get the values of the transformation from the matrix: displacement, scale y turn.

12 3D: Translation x´100t x x y´010t y y z´001t z z x´=x+t x y´=y+t y z´=z+t z

13 3D: Scale x´s x 000x y´0s y 00y z´00s z 0z x´= s x ·x y´= s y ·y z´= s z ·z

14 3D: Non uniform scale s x  s y  s z

15 3D: Rotation

16 3D: Rotation matrix x´1000x y´0cos θ-sin θ0y z´0sin θcos θ0z X Rotation x´cos θ 0sin θ 0x y´0100y z´-sin θ 0cos θ0z Y Rotation x´ cos θ-sin θ00x y´sin θcos θ00y z´0010z Z Rotation

17 Others transformations x´10a0x y´01b0y z´0010z Shear in xy (z invariant) x´1000x y´0100y z´00-10z Reflexion on plane xy

18 Composite transformation The transformations can be applied sequentially to a point. –The result of the first transformation: M 1 · P –The second transformation: M 2 ·[ M 1 · P] = [M 2 · M 1 ] · P The composite transformation is made by the product of the matrix M = M n ·M n-1 ·… ·M 2 · M 1

19 Transformation product may not be commutative

20 Hierarchic structure An object is positioned in its coordinate system. All the assembly can be positioned in another coordinate system and so successively. The coordinates in the final system are got by the composite transformation.

21 Pivot-point rotation When the axis doesn't cross the coordinate origin, the next operations are required: –Translate the pivot-point Q, to the coordinate origin –Rotate the object –Make the inverse translation The composite transformation matrix is: M R Q (θ) = M 3 · M 2 · M 1 M R Q (θ) = M T (q x, q y, q z ) ·M R (θ) · M T (-q x, -q y, -q z ) The fixed point scaling is done in the same way

22 x y z θ Q R O r Rotation around an axis The axis is defined by a point “Q” and a unit vector “r”. The rotation has a value defined by angle θ. It is solved with a compositionof transformations –Definition of transformations –Calculation of each one –Explanation of calculation of required angles

23 Rotation around an axis : composition of transformations Rotation -β around x x y z Q R r x y z Q’ R’ x y z Q’ R´´ Rotation -  around z Traslation -QO Initial Position x y z Q R r x y z Q’ R’ x y z Q’ R´´ x y z Q’ R´´´ Traslation QO Rotation  around z Rotation β around x Rotation θ around y x y z Q’ R´´´ Initial Position M1M1 M2M2 M3M3 M4M4 M5M5 M6M6 M7M7

24 Rotation around an axis: relation of transformations The transformation matrix is: M (Q,r) (θ) = M 7 · M 6 · M 5 · M 4 · M 3 · M 2 · M 1 M 1 : traslation QO M 2 : rotation  around z M 3 : rotation  around x M 4 : rotation  around y M 5 : rotation -  around x M 6 : rotation -  around z M 7 : traslation -QO

25 x y z θ Q R O r x y z Q’ R’ Rotation around an axis : M 1 - traslation QO –We define R so OR = OQ + r –The translation that moves Q to the origin is: M 1 = M T (-q x, -q y, -q z ) M1M1

26 R´´ x y r xy z Q’ R’ α

27 R´´ x y r xy z Q’ R’ α Rotation around an axis: M 2 - rotation  around z –Calculation of the  angle between the planes YZ and the plane defined by the z axis and OR’ r xy is the orthogonal projection of r on XY R’’ is the result of rotating around z  is the angle between r xy and j (unit vector of y) The positive direction of k must be taken into account –M 2 is the rotation matrix around the z axis: M 2 = M Rz (  )

28 Rotation around an axis: M 3 - rotation β around x –Applying M 2 to R’ we get R’’ R’’ is on the YZ plane r’’ is defined by OR’’ –Calculation of the β angle between r’’ and j The positive direction of i must be taken into account –M 3 is the rotation matrix around the x axis: M 3 = M Rx (β) x y z Q’ R´´´ R´´ β

29 Rotation around an axis: M 4 - rotation θ around y –Applying M 3 to R’’ we get R’’’ R’’’ is on the y axis –The rotation θ is done around the y axis –M 4 is the rotation matrix around the y axis: M 4 = M Ry (θ) x y z Q’ R´´´

30 Rotation around an axis: M 5, M 6, M 7 - inverses –After calculating the θ rotation around the transformed axis, it is necessary to invert the transformation process. To do it, the inverses matrices have to be calculated. M 5 = M Rx (-β) M 6 = M Rz (-  ) M 7 = M T (q x, q y, q z ) –The composed transformation matrix is: –M (Q,r) (θ) = M 7 · M 6 · M 5 · M 4 · M 3 · M 2 · M 1

31  = acos ( r y / (r x 2 + r y 2 ) 1/2 ) y si r x < 0   = -  α y z x α r xy j R´´ x y r xy z Q’ R’ α Rotation around an axis:  angle –Calculation of  angle r xy is the orthogonal projection of r on the XY plane: (r x, r y, 0) cos  = j · r xy / | r xy | = = ( (0, 1, 0) · (r x, r y, 0) ) / (r x 2 + r y 2 ) 1/2 cos  = r y / (r x 2 + r y 2 ) 1/2 As cos  = cos (–  ), then –if r x < 0 then the angle must be (2  -  )   = - 

32 β = acos ( r y ´´ / (r y ´´ 2 + r z ´´ 2 ) 1/2 ) y si r z ´´ > 0  β = - β x y z Q’ R´´´ R´´ β β β r´´j z x y Rotation around an axis: β angle –Calculation of β angle R’’ and r’’ are on the YZ plane cos β = j · r´´ / | r´´| = = ( (0, 1, 0) · (0, r y ´´, r z ´´) ) / (r y ´´ 2 + r z ´´ 2 ) 1/2 cos β = r y ´´ / (r y ´´ 2 + r z ´´ 2 ) 1/2 As cos β = cos (–β), then –if r z ´´ > 0 then the angle must be (2  - β)  β = - β


Download ppt "Transformations. Content Coordinate systems 2D Transformations 3D Transformations Transformation composition Rotating about a pivot Rotating about an."

Similar presentations


Ads by Google