Rotation matrix: Difference between revisions
imported>Paul Wormer |
imported>Paul Wormer |
||
Line 252: | Line 252: | ||
If the vectors are parallel, '''f''' = '''t''', then '''u''' = '''0''', '''U''' = '''0''' and '''f'''•'''t''' = cosφ = 1, | If the vectors are parallel, '''f''' = '''t''', then '''u''' = '''0''', '''U''' = '''0''' and '''f'''•'''t''' = cosφ = 1, | ||
so that the equation is well-defined—it gives '''R'''(φ, ''n'') = '''E''', as expected. | so that the equation is well-defined—it gives '''R'''(φ, ''n'') = '''E''', as expected. | ||
Provided '''f''' and '''t''' are not anti-parallel, the matrix <math>\mathbf{R}(\phi, \hat{n})</math> | |||
can be computed easily and quickly. It requires not much more than the computation of the inner and cross product of '''f''' and '''t'''. | |||
===Case that "from" and "to" vectors are anti-parallel=== | |||
If the vectors '''f''' and '''t''' are anti-parallel, '''f''' = − '''t''', then '''f'''•'''t''' = cosφ = − 1, and the denominator in the last equation becomes zero, so that the equation is not applicable. | |||
The rotation axis '''u''' ≡ '''f''' × '''t''' = '''f''' × (−'''f''') = '''0'''. Clearly, a two-fold rotation (angle 180°) around ''any'' rotation axis perpendicular to '''f''' and '''t''' will map '''f''' onto '''−f'''. This freedom in choice of the two-fold axis is consistent with the indeterminacy in the equation that occurs for cosφ = −1. | |||
Since '''f''' and '''t''' are related by inversion (with matrix −'''E'''), one could naively assume that all position vectors of the rigid body may be inverted. However, if the rigid body is not symmetric under inversion (does not have a symmetry center), inversion turns the body into a non-equivalent one. For instance, if the body is a right-hand glove, inversion will send it into a left-hand glove and as is well-known a right-hand glove differs from a left-hand glove. | |||
Recall that '''f''' is a unit vector. If '''f''' is on the ''z''-axis, |''f''<sub>''z''</sub>| = 1, then the following rotation around the ''y''-axis turns '''f''' into −'''f''' = '''t''': | |||
:<math> | |||
\mathbf{R}(\pi, \hat{e}_{y}) \mathbf{f} = | |||
\begin{pmatrix} | |||
-1 & 0 & 0 \\ | |||
0 & 1 & 0 \\ | |||
0 & 0 & -1 \\ | |||
\end{pmatrix} | |||
\begin{pmatrix} | |||
0 \\ 0 \\\pm 1 | |||
\end{pmatrix} = | |||
\begin{pmatrix} | |||
0 \\ 0 \\\mp 1 | |||
\end{pmatrix} | |||
</math> | |||
If '''f''' is not on the ''z''-axis, ''f''<sub>''z''</sub> ≠ 1, then the following orthogonal matrix sends '''f''' to −'''f''' and hence gives a 180° rotation of the rigid body | |||
:<math> | |||
\mathbf{R}(\pi, \hat{e}_{y'}) \mathbf{f} = | |||
\frac{1}{1-f^2_z} \begin{pmatrix} | |||
-(f^2_x-f^2_y) & -2f_xf_y & 0 \\ | |||
-2f_xf_y &(f^2_x-f^2_y) & 0 \\ | |||
0 & 0 & -(1-f^2_z) \\ | |||
\end{pmatrix} | |||
\begin{pmatrix} | |||
f_x \\ f_y \\ f_z | |||
\end{pmatrix} = | |||
\begin{pmatrix} | |||
-f_x \\ -f_y \\ -f_z | |||
\end{pmatrix} | |||
</math> | |||
To show this we must use relations of the type | |||
:<math> | |||
\frac{1}{1-f^2_z} \big( -f_x(f^2_x-f^2_y) -2f_x f_y^2 \big)= | |||
\frac{-f_x}{1-f^2_z} \big( (f^2_x-f^2_y) + 2f_y^2 \big)= | |||
\frac{-f_x}{1-f^2_z} ( f^2_x+f^2_y ) = | |||
\frac{-f_x}{1-f^2_z} (1 - f^2_z ) = -f_x. | |||
</math> | |||
Given '''f''' = (''f''<sub>''x''</sub>, ''f''<sub>''y''</sub>, ''f''<sub>''z''</sub>), the matrix <math>\mathbf{R}(\pi, \hat{e}_{y'})</math> is easily and quickly calculated. | |||
==References== | ==References== | ||
<references /> | <references /> |
Revision as of 04:06, 27 May 2009
In mathematics and physics a rotation matrix is synonymous with a 3×3 orthogonal matrix, which is a matrix R satisfying
where T stands for the transposed matrix and R−1 is the inverse of R.
Connection of an orthogonal matrix to a rotation
In general a motion of a rigid body (which is equivalent to an angle and distance preserving transformation of affine space) can be described as a translation of the body followed by a rotation. By a translation all points of the rigid body are displaced, while under a rotation at least one point stays in place. Let the the fixed point be O. By Euler's theorem follows that then not only the point is fixed but also an axis—the rotation axis— through the fixed point. Write for the unit vector along the rotation axis and φ for the angle over which the body is rotated, then the rotation operator on is written as
Erect three Cartesian coordinate axes with the origin in the fixed point O and take unit vectors along the axes, then the 3×3 rotation matrix is defined by its elements :
In a more condensed notation this equation can be written as
Given a basis of a linear space, the association between a linear map and its matrix is one-to-one.
Since a rotation (for convenience sake the rotation axis and angle are suppressed in the notation) leaves all angles and distances invariant, for any pair of vectors and in the inner product is invariant, that is,
A linear map with this property is called orthogonal. It is easily shown that a similar vector-matrix relation holds. First we define column vectors (stacked triplets of real numbers given in bold face):
and observe that the inner product becomes by virtue of the orthonormality of the basis vectors
The invariance of the inner product under the rotation operator leads to
since this holds for any pair a and b it follows that a rotation matrix satisfies
where E is the 3×3 identity matrix. For finite-dimensional matrices one shows easily
A matrix with this property is called orthogonal. So, a rotation gives rise to a unique orthogonal matrix.
Conversely, consider an arbitrary point P in the body and let the vector connect the fixed point O with P. Expressing this vector with respect to a Cartesian frame in O gives the column vector p (three stacked real numbers). Multiply p by the orthogonal matrix R, then p′ = Rp represents the rotated point P′ (or, more precisely, the vector is represented by column vector p′ with respect to the same Cartesian frame). If we map all points P of the body by the same matrix R in this manner, we have rotated the body. Thus, an orthogonal matrix leads to a unique rotation. Note that the Cartesian frame is fixed here and that points of the body are rotated, this is known as an active rotation. Instead, the rigid body could have been left invariant and the Cartesian frame could have been rotated, this also leads to new column vectors of the form p′ ≡ Rp, such rotations are called passive.
Properties of an orthogonal matrix
Writing out matrix products it follows that both the rows and the columns of the matrix are orthonormal (normalized and orthogonal). Indeed,
where δij is the Kronecker delta.
Orthogonal matrices come in two flavors: proper (det = 1) and improper (det = −1) rotations. Indeed, invoking some properties of determinants, one can prove
Compact notation
A compact way of presenting the same results is the following. Designate the columns of R by r1, r2, r3, i.e.,
- .
The matrix R is orthogonal if
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{r}_i^\mathrm{T} \mathbf{r}_j \equiv \mathbf{r}_i \cdot \mathbf{r}_j = \delta_{ij}, \quad i,j = 1,2,3 . }
The matrix R is a proper rotation matrix, if it is orthogonal and if r1, r2, r3 form a right-handed set, i.e.,
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{r}_i \times \mathbf{r}_j = \sum_{k=1}^3 \, \varepsilon_{ijk} \mathbf{r}_k . }
Here the symbol × indicates a cross product and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varepsilon_{ijk}} is the antisymmetric Levi-Civita symbol,
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} \varepsilon_{123} =&\; \varepsilon_{312} = \varepsilon_{231} = 1 \\ \varepsilon_{213} =&\; \varepsilon_{321} = \varepsilon_{132} = -1 \end{align} }
and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varepsilon_{ijk} = 0} if two or more indices are equal.
The matrix R is an improper rotation matrix if its column vectors form a left-handed set, i.e.,
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{r}_i \times \mathbf{r}_j = - \sum_{k=1}^3 \, \varepsilon_{ijk} \mathbf{r}_k \; . }
The last two equations can be condensed into one equation
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{r}_i \times \mathbf{r}_j = \det(\mathbf{R}) \sum_{k=1}^3 \; \varepsilon_{ijk} \mathbf{r}_k }
by virtue of the the fact that the determinant of a proper rotation matrix is 1 and of an improper rotation −1. This was proved above, an alternative proof is the following: The determinant of a 3×3 matrix with column vectors a, b, and c can be written as scalar triple product
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \det\left(\mathbf{a},\,\mathbf{b},\, \mathbf{c}\right) = \mathbf{a} \cdot (\mathbf{b}\times\mathbf{c}) } .
It was just shown that for a proper rotation the columns of R are orthonormal and satisfy,
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{r}_1 \cdot (\mathbf{r}_2 \times \mathbf{r}_3 ) = \mathbf{r}_1 \cdot\left(\sum_{k=1}^3 \, \varepsilon_{23k} \, \mathbf{r}_k \right) = \varepsilon_{231} = 1 . }
Likewise the determinant is −1 for an improper rotation.
Explicit expression of rotation operator
Let Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \overrightarrow{OP} \equiv \vec{r}} be a vector pointing from the fixed point O of a rotating rigid body to an arbitrary point P of the body. A rotation of this arbitrary vector around the unit vector Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \hat{n}} over an angle φ can be written as
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathcal{R}(\varphi, \hat{n})(\vec{r}\,)\equiv \vec{r}\,' = \vec{r}\;\cos\phi + \hat{n} (\hat{n}\cdot\vec{r}\,)\; (1- \cos\varphi) + (\hat{n} \times \vec{r}\,) \sin\varphi . }
where • indicates an inner product and the symbol × a cross product.
It is easy to derive this result. Indeed, decompose the vector to be rotated into two components, one along the rotation axis and one perpendicular to it (see the figure on the right)
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{r} = \vec{r}_\parallel + \vec{r}_\perp\quad\hbox{with}\quad \vec{r}_\parallel = \hat{n} (\hat{n}\cdot\vec{r}\,), \quad \vec{r}_\perp = \vec{r}- \hat{n} (\hat{n}\cdot\vec{r}\,). }
Upon rotation the component along the axis is invariant, only the component orthogonal to the axis changes. By virtue of the fact that
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle |\vec{r}_\perp| = |\hat{n} \times \vec{r}\,| = \sqrt{|\vec{r}\,|^2 - (\hat{n}\cdot\vec{r}\,)^2}, }
the rotation property simply is
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{r}_\perp \mapsto \vec{r}\,'_\perp = \cos\phi\;\vec{r}_\perp + \sin\phi\;(\hat{n}\times\vec{r}\,). }
Hence
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{r}\,' = \left[\vec{r}- (\hat{n}\cdot\vec{r}\,) \hat{n}\right]\cos\phi+(\hat{n}\times\vec{r}\,)\sin\phi + \hat{n} (\hat{n}\cdot\vec{r}\,). }
Some reshuffling gives the required result.
Explicit expression of rotation matrix
It will be shown that
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{R}(\phi, \hat{n}) = \mathbf{E} + \sin\phi \mathbf{N} +(1-\cos\phi)\mathbf{N}^2, }
where (see cross product for more details)
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbf{N} \equiv \begin{pmatrix} 0 & -n_z & n_y \\ n_z& 0 & -n_x \\ -n_y& n_x & 0 \end{pmatrix}\quad\hbox{and}\quad \hat{n} \equiv (\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\,) \begin{pmatrix} n_x \\ n_y \\ n_z \\ \end{pmatrix} \equiv (\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\,) \; \hat{\mathbf{n}} }
Note further that the dyadic product satisfies (as can be shown by squaring N),
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \hat{\mathbf{n}}\otimes\hat{\mathbf{n}} = \mathbf{N}^2 + \mathbf{E}, \quad\hbox{with}\quad |\hat{\mathbf{n}}| = 1 }
and that
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \hat{n} (\hat{n}\cdot\vec{r}\,) \leftrightarrow (\hat{\mathbf{n}}\otimes\hat{\mathbf{n}})\;\mathbf{r} = \left(\mathbf{N}^2 + \mathbf{E}\right) \mathbf{r}. }
Translating the result of the previous section to coordinate vectors and substituting these results gives
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} \mathbf{r}' &= \left[\cos\phi\; \mathbf{E} +(1-\cos\phi)(\mathbf{N}^2 + \mathbf{E}) + \sin\phi \mathbf{N} \right] \mathbf{r} \\ &= \left[\mathbf{E} + (1-\cos\phi) \mathbf{N}^2 + \sin\phi \mathbf{N}\right] \mathbf{r}, \end{align} }
which gives the desired result for the rotation matrix. This is equation is identical to Eq. (2.6) of Biedenharn and Louck[1], who give credit to Leonhard Euler (ca. 1760) for this result.
The equation is a special case of the transformation properties given on p. 7 of the classical work (first edition 1904) of Whittaker[2]. To see the correspondence with Whittaker's formula, which includes also a translation over a displacement d and who rotates the vector (x−a, y−b, z−c), we must put equal to zero: a, b, c, and d in Whittaker's equation. Furthermore he uses that the components of the unit vector n are the direction cosines of the rotation axis:
Under these conditions the rotation becomes
Vector rotation
Sometimes it is necessary to line-up a given vector in a rigid body (for instance a chemical bond in a molecule) with an external vector (for instance a coordinate vector). Let the vector in the body be f (the "from" vector) and the vector to which f must be rotated be t (the "to" vector). Let both vectors be unit vectors (length 1). From the definition of the inner product and the cross product follows that
where φ is the angle (< 180°) between the two vectors. Since the cross product f × t is a vector perpendicular to the plane of both vectors, it is easily seen that a rotation around the cross product vector over an angle φ moves f to t.
Write
Define accordingly
so that
The last equation, which follows from U2 = u⊗u − sin2φ E, is Eq. (1) of Ref. [3] after substitution of
If the vectors are parallel, f = t, then u = 0, U = 0 and f•t = cosφ = 1, so that the equation is well-defined—it gives R(φ, n) = E, as expected. Provided f and t are not anti-parallel, the matrix can be computed easily and quickly. It requires not much more than the computation of the inner and cross product of f and t.
Case that "from" and "to" vectors are anti-parallel
If the vectors f and t are anti-parallel, f = − t, then f•t = cosφ = − 1, and the denominator in the last equation becomes zero, so that the equation is not applicable. The rotation axis u ≡ f × t = f × (−f) = 0. Clearly, a two-fold rotation (angle 180°) around any rotation axis perpendicular to f and t will map f onto −f. This freedom in choice of the two-fold axis is consistent with the indeterminacy in the equation that occurs for cosφ = −1.
Since f and t are related by inversion (with matrix −E), one could naively assume that all position vectors of the rigid body may be inverted. However, if the rigid body is not symmetric under inversion (does not have a symmetry center), inversion turns the body into a non-equivalent one. For instance, if the body is a right-hand glove, inversion will send it into a left-hand glove and as is well-known a right-hand glove differs from a left-hand glove.
Recall that f is a unit vector. If f is on the z-axis, |fz| = 1, then the following rotation around the y-axis turns f into −f = t:
If f is not on the z-axis, fz ≠ 1, then the following orthogonal matrix sends f to −f and hence gives a 180° rotation of the rigid body
To show this we must use relations of the type
Given f = (fx, fy, fz), the matrix is easily and quickly calculated.
References
- ↑ L. C. Biedenharn and J. D. Louck, Angular Momentum in Quantum Physics, Addison-Wesley, Reading, Mass. (1981) ISBN 0-201-13507-8
- ↑ E. T. Whittaker, A Treatise on the Dynamics of Particles and Rigid Bodies, Cambridge University Press (1965)
- ↑ T. Möller and J. F. Hughes, J. Graphics Tools, 4(4) pp. 1-4 (1999).