Transformations
Transformations are functions that map n -D vectors to other n -D vectors: . They can represent geometric operations, which are caused by movement or action, as well as changes of coordinates, which are caused by changes of interpretation. Many common spatial transformations, including translations, rotations, and scaling are represented by matrix / vector operations. Changes of coordinate frames are also matrix / vector operations. As a result, transformation matrices are stored and operated on ubiquitously in robotics.
1. Linear transformations
A linear transformation is one that can be represented as a matrix operation:
where , , and A is an m×n matrix. In
particular, in 2D, this operation takes the form
In 3D, a linear transformation takes the form
2. Rotations in 2D
Rotations about the origin by angle θ can be defined as linear transformations. Consider two reference frames with a common origin O , the pre-rotation axes X and Y , and the post-rotation axes X′ and Y′ . Depicting X′ on top of X and Y as a line emanating
from the origin, and using a little trigonometry, we shall see that X′ has coordinates x′=(cosθ,sinθ) . It is a bit more involved, but not much, to determine that Y′ has coordinates y′=(−sinθ,cosθ) .
Now consider that along with the coordinate frames, a point P was rotated to P′ . We will derive how to determine its new coordinates relative to the original reference frame. Notice that P′ still has coordinates (px,py) relative
to the post-rotation frame X′ , Y′ , since distances do not shrink or grow when objects are rotated. Specifically, P′ is obtained by walking px units from the origin in the direction of X′ , and then py units in the direction of Y′ (Fig.
5). Hence, to determine its coordinates in the original reference frame, we can use the fact that the coordinates of X′ and Y′ are known:
Rotating at an angle θ about the origin to achieve a new point P′ (a). To calculate the coordinates of P′ (b), we first obtain the coordinates of transformed axes X′ and Y′ (c,d) and then use the parallelogram rule (e).
A more compact and convenient way of writing this is with a matrix equation
with the rotation matrix given by
There are several useful properties of such matrices:
1.The matrix composition R(θ1)R(θ2)=R(θ1+θ2) gives the rotation matrix for the sum of the angles.
2.The determinant det(R(θ))= for all θ .
3.Due to the identities cos(−θ)=cos(θ) and sin(−θ)=−sin(θ) , the operation of rotating about −θ is equivalent to a matrix transpose:
4.Moreover, the transpose is equivalent to the matrix inverse:
In other words, rotation matrices are orthogonal.
5.Vector norms are invariant under rotation:
6.The rotation matrix is only dependent on the argument's value modulo 2π.
The space of rotations is known as the special orthogonal group SO(2) . The reason why it is called the special orthogonal group is that it is the set of all orthogonal 2×2 matrices with positive determinant, while there do exist
other orthogonal matrices with determinant -1.
Property 4 implies that it is more proper to consider rotation matrices as only representing instantaneous orientation rather than accumulated amounts of revolution. For example, if a motor has spun , the matrix representation is indistinguishable from the 0 rotation. In certain applications that demand reasoning about accumulated revolution, the representation θ∈R is more appropriate than a matrix. More about this
topic will be discussed when we cover topological spaces.
3. Rotations in 3D
A rotation in 3D can be represented by a matrix equation
After a rotation, the coordinates of the transformed point (relative to the original axes) are determined via a matrix multiplication with the rotation matrix R .
Like in 2D, rotation matrices satisfy several properties:
1.The composition of two rotation matrices is also a rotation matrix.
2.In general, however, unless the two are rotations about a shared axis.
3.The determinant det(R)=1 for all rotation matrices.
4.The transpose of a rotation matrix is its inverse: , or .
5.Vector norms are invariant under rotation.
The space of 3D rotations is known as the special orthogonal group SO(3)
Another interpretation of rotation matrices is to interpret each of the 3 columns as the coordinates of each of the coordinate axes after rotation. In other words, when a coordinate frame rotates by matrix R about the origin, the entries of the rotation matrix can be interpreted as:
here give the coordinates of the new X axis in the old frame, gives the coordinates of the new Y axis, and gives the coordinates of the new Z axis.
A 3D rotation is encoded by a 3×3 matrix whose columns give the coordinates of the rotated axes relative to the original axes.
This interpretation is useful when determining the coordinates of a rotated point in the original reference frame: if the point is given by coordinates such that , then the new coordinates of P relative to the old reference frame are given by Rp .