This section is divided into a number of subsections, links to which are:
The rotation of a digitized raster by an arbitrary angle is an essential function for many raster manipulation systems. A general two dimensional counterclockwise rotation of the point/vector (x, y) by angle θ is performed by multiplying the column vector [x, y]T from left by the rotation matrix [R] or multiplying the row vector [x, y] by matrix (R) from right:
\[
\left[ {\bf R} \right] (\theta ) = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} , \quad \left( {\bf R} \right) (\theta ) = \begin{pmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{pmatrix} .
\]
Note that we embrace the rotation matrix into brackets when it acts on column vectors from left, and correspondingly place the rotation matrix into parentheses to emphases that it operates on row vectors from right. Obviously, these two approaches are equivalent and require transposition operation to transfer one case into another.
This rotation matrix is orthogonal, that is it is skey-symmetrix, rows and columns are unit vectors, and the determinant is +1.
2D Rotations by three shears
We abbreviate shear matrices with Cyrillic letter "Ш," which is pronounced as "sha" in English or "ch" in French. Shear 2-by-2 matrices,
\[
{\bf Ш}_{x} (\alpha ) = \begin{bmatrix} 1&\alpha \\ 0&1 \end{bmatrix} , \qquad {\bf Ш}_{y} (\beta ) = \begin{bmatrix} 1&0 \\ \beta &1 \end{bmatrix} ,
\]
are closely related to rotation matrices because they also have determinant to be +1. So orthogonal and shear matrices belong to the group SE(2).
Products of shear matrices along the same axis producea conforming shear:
\[
\begin{bmatrix} 1&\alpha \\ 0&1 \end{bmatrix} \begin{bmatrix} 1&\beta \\ 0&1 \end{bmatrix} = \begin{bmatrix} 1&\alpha + \beta \\ 0&1 \end{bmatrix} .
\]
Hence, shear products may be restricted to products of alternating x and y shears, without any loss of generality.
{{1, a}, {0, 1}} . {{1, 0}, {b, 1}}
\( \displaystyle \quad \begin{pmatrix} 1 + a\,b & a \\ b & 1 \end{pmatrix} \)
{{1, 0}, {b, 1}} . {{1, a}, {0, 1}}
\( \displaystyle \quad \begin{pmatrix} 1 & a \\ b & 1 + a\,b\end{pmatrix} \)
Products of three shears give rise to a general 2 × 2 matrix in which three arbitrary entries may be specified. The fourth element will take on a value that ensures determinant to be +1. Rotation 2-by-2 marices also have unit determinants, and may thus be decomposed into a product of no more than three shears:
\[
\begin{bmatrix} 1&\alpha \\ 0&1 \end{bmatrix} \begin{bmatrix} 1&0 \\ \beta&1 \end{bmatrix} \begin{bmatrix} 1&\gamma \\ 0&1 \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta&\cos\theta \end{bmatrix} .
\]
Solving this general equation, we get
\[
\alpha = \gamma = 1 - \frac{\cos\theta}{\sin\theta} , \qquad \beta = \sin\theta .
\]
\[
\alpha = \gamma = \tan \left( \frac{\theta}{2} \right) .
\]
Example 1:
■
End of Example 1
3D Rotations by three shears
- Dunn, F. and Parberry, I., 3D Math Primer for Graphics and Game Development, Second Edition, A K Peters, CRC Press, 2011.
- Paeth, A.W., A fast algorithm for general raster rotation, Proceedings, Graphics Interface '86, pp 77{81, Canadian Information Processing Society, Vancouver, 1986. Reprinted with corrections and additions in Graphics Gems (Andrew Glassner, Ed.), pp 179{195, Academic Press, New York, 1990.
- Toffoli, T., Quick, J., Three-dimensional rotations by three shears, Graphical Models and Image Processing, 59 (1997), pp. 89--96.