Rotation matrix

angle 2, where cos  = w and |sin | = ||(x,y,z)||. (The proper sign for sin  is implied once the signs of the axis components are decided.)

Many features of this case are the same for higher dimensions. The coverings are all two-to-one, with SO(n), n > 2, having fundamental group Z2. The natural setting for these groups is within a Clifford algebra. And the action of the rotations is produced by a kind of “sandwich”, denoted by qvq.

Infinitesimal rotations

The matrices in the Lie algebra are not themselves rotations; the skew-symmetric matrices are derivatives, proportional differences of rotations. An actual “differential rotation”, or infinitesimal rotation matrix has the form

where d is vanishingly small. These matrices do not satisfy all the same properties as ordinary finite rotation matrices under the usual treatment of infinitesimals (Goldstein, Poole & Safko 2002, 4.8). To understand what this means, consider

We first test the orthogonality condition, QTQ = I. The product is

differing from an identity matrix by second order infinitesimals, which we discard. So to first order, an infinitesimal rotation matrix is an orthogonal matrix. Next we examine the square of the matrix.

Again discarding second order effects, we see that the angle simply doubles. This hints at the most essential difference in behavior, which we can exhibit with the assistance of a second infinitesimal rotation,

Compare the products dAxdAy and dAydAx.

Since d d is second order, we discard it; thus, to first order, multiplication of infinitesimal rotation matrices is commutative. In fact,

again to first order. Put in other words, the order in which infinitesimal rotations are applied is irrelevant, this useful fact makes, for example, derivation of rigid body rotation relatively simple.

But we must always be careful to distinguish (the first order treatment of) these infinitesimal rotation matrices from both finite rotation matrices and from derivatives of rotation matrices (namely skew-symmetric matrices). Contrast the behavior of finite rotation matrices in the BCH formula with that of infinitesimal rotation matrices, where all the commutator terms will be second order infinitesimals so we do have a vector space.

Conversions

Main article: Rotation representation (mathematics)#Conversion formulae between representations

It has been suggested that this article or section be merged into Rotation representation (mathematics)#Conversion formulae between representations. (Discuss)

We have seen the existence of several decompositions that apply in any dimension, namely independent planes, sequential angles, and nested dimensions. In all these cases we can either decompose a matrix or construct one. We have also given special attention to 33 rotation matrices, and these warrant further attention, in both directions (Stuelpnagel 1964).

Quaternion

Main article: Quaternions and spatial rotation

Given the unit quaternion q = (w,x,y,z), the equivalent 33 rotation matrix is

Now every quaternion component appears multiplied by two in a term of degree two, and if all such terms are zero what’s left is an identity matrix. This leads to an efficient, robust conversion from any quaternion whether unit, nonunit, or even zero to a 33 rotation matrix.

Nq = w^2 + x^2 + y^2 + z^2

if Nq > 0.0 then s = 2/Nq else s = 0.0

X = x*s; Y = y*s; Z = z*s

wX = w*X; wY = w*Y; wZ = w*Z

xX = x*X; xY = x*Y; xZ = x*Z

yY = y*Y; yZ = y*Z; zZ = z*Z

[ 1.0-(yY+zZ) xY-wZ xZ+wY ]

[ xY+wZ 1.0-(xX+zZ) yZ-wX ]

[ xZ-wY yZ+wX 1.0-(xX+yY) ]

Freed from the demand for a unit quaternion, we find that nonzero quaternions act as homogeneous coordinates for 33 rotation matrices. The Cayley transform, discussed earlier, is obtained by scaling the quaternion so that its w component is 1. For a 180 rotation around any axis, w will be zero, which explains the Cayley limitation.

The sum of the entries along the main diagonal (the trace), plus one, equals 44(x2+y2+z2), which is 4w2. Thus we can write the trace itself as 2w2+2w21; and from the previous version of the matrix we see that the diagonal entries themselves have the same form: 2×2+2w21, 2y2+2w21, and 2z2+2w21. So we can easily compare the magnitudes of all four quaternion components using the matrix diagonal. We can, in fact, obtain all four magnitudes using sums and square roots, and choose consistent signs using the skew-symmetric part of the off-diagonal entries.

w = 0.5*sqrt(1+Qxx+Qyy+Qzz)

x = copysign(0.5*sqrt(1+Qxx-Qyy-Qzz),Qzy-Qyz)

y = copysign(0.5*sqrt(1-Qxx+Qyy-Qzz),Qxz-Qzx)

z = copysign(0.5*sqrt(1-Qxx-Qyy+Qzz),Qyx-Qxy)

where copysign(x,y) is x with the sign of y:

Alternatively, use a single square root and division

t = Qxx+Qyy+Qzz

r = sqrt(1+t)

s = 0.5/r

w = 0.5*r

Pages: 1 2 3 4 5 6 7 8 9 10