Title: Composite 3D Transformations
1Composite 3D Transformations
2Example of Composite 3D Transformations
Try to transform the line segments P1P2 and P1P3
from their start position in (a) to their ending
position in (b). The first solution
is to compose the primitive transformations T,
Rx, Ry, and Rz. This approach is easier to
illustrate and does offer help on building an
understanding. The 2nd, more abstract approach is
to use the properties of special orthogonal
matrices.
(a)
(b)
3Composition of 3D Transformations
Breaking a difficult problem into simpler
sub-problems 1.Translate P1 to the
origin. 2. Rotate about the y axis such that
P1P2 lies in the (y, z) plane. 3. Rotate about
the x axis such that P1P2 lies on the z
axis. 4. Rotate about the z axis such that P1P3
lies in the (y, z) plane.
4Composition of 3D Transformations
1. 2.
5Composition of 3D Transformations
3 4.
Finally, we have the composite matrix
6Vector Rotation
y
y
u
Rotate the vector
?
x
x
The unit vector along the x axis is 1, 0T.
After rotating about the origin by ?, the
resulting vector is
7Vector Rotation (cont.)
y
y
Rotate the vector
?
v
x
x
Similarly, the unit vector along the y axis is
0, 1T. After rotating about the origin by ?,
the resulting vector is
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.
8Vector 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.
9Example
what is the rotation matrix if one wants the
vector T in the left figure to be rotated to the
direction of 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
10Rotation 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
11Cross Product
- The cross product or vector product of two
vectors, v1 and v2, is another vector - The cross product of two vectors is orthogonal to
both - Right-hand rule dictates direction of cross
product.
v2
v1? v2
v1
12 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.
v
In 3D, however, we need to know more than one
vector. See in the left figure, for example, two
vectors, u1 and u2 are given. If after rotation,
u1 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?
y
u2
u1
z
x
vu1?u2
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. Lets see
the example
Note, in this example, vector P1P2 will be
rotated to the positive z direction. Hence the
fist column vector in the rotation matrix is the
normalised P1P2. But what about the other two
columns? After all, P1P3 is not perpendi-cular to
P1P2. Well, we can find it by taking the cross
product of P1P2 and P1P3. Since P1P2 ? P1P3 is
perpendicular to both P1P2 and P1P3, it will be
aligned into the direction of the positive x axis.
P3
P2
P1
P3
P1
P2
14 3D Rotation (cont.)
And the third direction is decide by the cross
product of the other two directions, which is
P1P2 ?(P1P2 ?P1P2 ). Therefore, the rotation
matrix should be
15Yaw, Pitch, and Roll
Imagine three lines running through an airplane
and intersecting at right angles at the
airplanes centre of gravity.
Roll rotation around the front-to-back axis.
Roll rotation around the side-to-side axis.
Roll rotation around the vertical axis.
16An 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.
17Solution to the Airplane Example
First we are to rotate the positive zp direction
into the direction of DOF, which gives us the
third column of the rotation matrix DOF / DOF.
The xp axis must be transformed into a horizontal
vector perpendicular to DOF that is in the
direction of y?DOF. The yp direction is then
given by xp ? zp DOF ?(y ? DOF).
18Inverses of (2D and) 3D Transformations
- Translation
-
- Scaling
- Rotation
- Shear