Presentation is loading. Please wait.

Presentation is loading. Please wait.

Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.

Similar presentations


Presentation on theme: "Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position."— Presentation transcript:

1 Composite 3D Transformations

2 Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position in (a) to their ending position in (b). The first solution is to compose the primitive transformations T, R x, R y, and R z. This approach is easier to illustrate and does offer help on building an understanding. The 2 nd, more abstract approach is to use the properties of special orthogonal matrices. y x z y x z P1P1 P2P2 P3P3 P1P1 P2P2 P3P3 (a) (b)

3 Composition of 3D Transformations Breaking a difficult problem into simpler sub-problems: 1.Translate P 1 to the origin. 2. Rotate about the y axis such that P 1 P 2 lies in the (y, z) plane. 3. Rotate about the x axis such that P 1 P 2 lies on the z axis. 4. Rotate about the z axis such that P 1 P 3 lies in the (y, z) plane. y x z y x z y x z P1P1 P2P2 P3P3 P1P1 P2P2 P3P3 y x z P1P1 P2P2 P3P3 y x z P1P1 P2P2 P3P3 P3P3 P2P2 P1P1 1 2 34

4 Composition of 3D Transformations 1. 2. y x z P1P1 P2P2 P3P3  D1D1

5 Composition of 3D Transformations 3 4. y x z P  1 P  2  D2D2 y x z P  1 P  2  D3D3 P  3 Finally, we have the composite matrix:

6 Vector Rotation x  y x y Rotate the vector u The unit vector along the x axis is [1, 0] T. After rotating about the origin by , the resulting vector is

7 x Vector Rotation (cont.) y Rotate the vector x y  v The above results states that if we try to rotate a vector, originally pointing the direction of the x (or y) axis, toward a new direction, u (or v), the rotation matrix, R, could be simply written as [u | v] without the need of any explicit knowledge of , the actual rotation angle. Similarly, the unit vector along the y axis is [0, 1] T. After rotating about the origin by , the resulting vector is

8 Vector Rotation (cont.) The reversed operation of the above rotation is to rotate a vector that is not originally pointing the x (or y) direction into the direction of the positive x or y axis. The rotation matrix in this case is R(-  ), expressed by R -1 (  ) where T denotes the transpose. x x  y y Rotate the vector u u

9 Example what is the rotation matrix if one wants the vector T in the left figure to be rotated to the direction of u. T (2, 3) u If, on the other hand, one wants the vector u to be rotated to the direction of the positive x axis, the rotation matrix should be

10 Rotation Matrices Rotation matrix is orthonormal: Each row is a unit vector Each row is perpendicular to the other, i.e. their dot product is zero. Each vector will be rotated by R(  ) to lie on the positive x and y axes, respectively. The two column vectors are those into which vectors along the positive x and y axes are rotated. For orthonormal matrices, we have

11 Cross Product The cross product or vector product of two vectors, v 1 and v 2, is another vector: The cross product of two vectors is orthogonal to both Right-hand rule dictates direction of cross product. v1v1 v2v2 v1 v2v1 v2

12 u2u2 Extension to 3D Cases The above examples can be extended to 3D cases…. In 2D, we need to know u, which will be rotated to the direction of the positive x axis. u v x y z u1u1 v=u 1  u 2 In 3D, however, we need to know more than one vector. See in the left figure, for example, two vectors, u 1 and u 2 are given. If after rotation, u 1 is aligned to the positive z axis, this will only give us the third column in the rotation matrix. What about the other two columns?

13 3D Rotation In many cases in 3D, only one vector will be aligned to one of the coordinate axes, and the others are often not explicitly given. Let’s see the example: y x z y x z P1P1 P2P2 P3P3 P1P1 P2P2 P3P3 Note, in this example, vector P 1 P 2 will be rotated to the positive z direction. Hence the fist column vector in the rotation matrix is the normalised P 1 P 2. But what about the other two columns? After all, P 1 P 3 is not perpendi- cular to P 1 P 2. Well, we can find it by taking the cross product of P 1 P 2 and P 1 P 3. Since P 1 P 2  P 1 P 3 is perpendicular to both P 1 P 2 and P 1 P 3, it will be aligned into the direction of the positive x axis.

14 And the third direction is decide by the cross product of the other two directions, which is P 1 P 2  (P 1 P 2  P 1 P 2 ). Therefore, the rotation matrix should be 3D Rotation (cont.) u y x z P1P1 P2P2 P3P3 v w y x z P1P1 P2P2 P3P3 u v

15 Yaw, Pitch, and Roll Imagine three lines running through an airplane and intersecting at right angles at the airplane’s centre of gravity. Roll: rotation around the front-to-back axis. Pitch: rotation around the side-to-side axis. Yaw: rotation around the vertical axis.

16 An Example of the Airplane Consider the following example. An airplane is oriented such that its nose is pointing in the positive z direction, its right wing is pointing in the positive x direction, its cockpit is pointing in the positive y direction. We want to transform the airplane so that it heads in the direction given by the vector DOF (direction of flight), is centre at P, and is not banked.

17 Solution to the Airplane Example First we are to rotate the positive z p direction into the direction of DOF, which gives us the third column of the rotation matrix: DOF / |DOF|. The x p axis must be transformed into a horizontal vector perpendicular to DOF – that is in the direction of y  DOF. The y p direction is then given by x p  z p = DOF  (y  DOF).

18 Inverses of (2D and) 3D Transformations 1.Translation: 2.Scaling: 3.Rotation: 4.Shear:

19 Transformation as a change of a coordinate System M i  j = the transformation that converts a representation of a point in coordinate system j into its representation in coordinate system i. P (i) = the representation of a point in coordinate system i. Let P (i) = M i  j. P (j) and P (i) = M j  k. P (k) Then, P (i) = M i  j. M j  k. P (k) = M i  k. P (i) So, M i  k = M i  j. M j  k Let, M 1  2 = T(4,2), M 2  3 = T(2,3). S(0.5,0.5) and M 3  4 = T(6.7, 1.8). R(45 o ) Then point P (1) = (10,8), P (2) = (6,6), P (3) = (8,6), and P (4) = (4,2) are in coordinate systems 1 through 4 respectively. M i  j = M j  i -1, So, M 2  1 = M 1  2 -1 = T(-4,-2),


Download ppt "Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position."

Similar presentations


Ads by Google