Everything2
Near Matches
Ignore Exact
Full Text
Everything2

rotation matrix

created by jprockwell

(idea) by jprockwell (6.3 mon) (print)   ?   (I like it!) Wed Mar 28 2001 at 8:07:41

A rotation matrix is a matrix which, when multiplied by the vector representing a point, has the effect of rotating that point around the origin. A rotation around the origin is a linear geometrical transformation.

In general, any orthogonal matrix with a determinant of 1 is a rotation matrix.

In two dimensions, the 2×2 matrix that rotates a 2D vector around the origin by an angle of θ is:

R(θ)

    | cos(θ) -sin(θ) |
  = |                 |
    | sin(θ)  cos(θ) |

(Note: the matrix should be multiplied from the right by a column vector.)

As with any other linear geometrical transformation, rotations may be composed by multiplying the matricies (see matrix multiplication) that represent them.

Rotations in 2D commute. That is, the rotation of a column vector v by θ1 and followed by the rotation by θ2 has the same effect as a single rotation by θ12. Of course, this seems obvious in 2D. In matrix form, this means that:

R2)(R1)v) = R12)v

The vectors forming the columns of the matrix are what the unit vectors along the axes are transformed to.

In three dimensions, rotation matricies are more complex. It's easiest to start with rotations around the three coordinate axes:

Rx(θ)


    | 1    0       0    |
  = | 0 cos(θ) -sin(θ) |
    | 0 sin(θ)  cos(θ) |
Ry(θ)

    |  cos(θ) 0 sin(θ) |
  = |     0    1    0   |
    | -sin(θ) 0 cos(θ) |

Rz(θ)

    | cos(θ) -sin(θ) 0 |
  = | sin(θ)  cos(θ) 0 |
    |    0       0    1 |
Here, Rx(θ) represents a rotation of θ around the x axis.

Rotation about an arbitrary axis u is given by the following formula:

Ru(θ)


  = uuT + cos(θ) (I - uuT) + sin(θ) cross(u)

where u = [ ux uy uz ]T is a unit column vector and cross(u) is the cross product operator matrix. In addition, I is the 3×3 identity matrix, and the 3×3 matrix uuT is a projection matrix.

Expanding the formula into a matrix, we get

    |  uxuxvθ+cθ  uxuyvθ-uzsθ uxuzvθ+uysθ |
  = | uyuxvθ+uzsθ  uyuyvθ+cθ  uyuzvθ-uxsθ |
    | uzuxvθ-uysθ uzuyvθ+uxsθ  uzuzvθ+cθ  |
where vθ = 1-cos(θ), cθ = cos(θ) and sθ = sin(θ).

Given an rotation matrix, you can extract the axis u and angle θ of the rotation that it represents. Suppose the rotation matrix R is given by

R
    | r11 r12 r13 |
  = | r21 r22 r23 |
    | r31 r32 r33 |
Then we can calculate
cosθ = ( r11 + r22 + r33 - 1) / 2
sinθ = ( (r21-r12)2 + (r13-r31)2 + (r32-r23)2 )1/2 / 2
ux = (r21-r12) / (2sinθ)
uy = (r13-r31) / (2sinθ)
uz = (r32-r23) / (2sinθ)
Note that u is undefined if θ is a multiple of 2π. That would mean that there actually is no rotation.

Rotations in 3D do not commute. For example, a 90° rotation around the x axis followed by a 90° rotation around the z axis does not have the same effect as a 90° rotation around the z axis followed by a 90° rotation around the x axis.


printable version
chaos

Geometric Transformations in Two Dimensions orthogonal matrix matrix multiplication computer graphics
Singular Value Decomposition six degrees of freedom linear transformation rotation
The Matrix is going down for a reboot in 5 minutes: all users, please save your data and log out Yaw cross product orthogonal
Gimbal Eight Virtues Great Pyrenees HTML symbol reference
Matrix dot product parallelogram learning
pitcher Wintermute Quaternion vector
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
What you are reading:
People's Park
false friend
Chinese has three words for "river"
Lamed Vav Zaddikim
Oxford English Dictionary
Why the willow weeps
the water cooler is evil
deliciously oily
runcible spoon
Oresteia
Gollum vs. Regis Philbin
The Strong Programme
Super Candles
New Writeups
Ysardo
a brother to a sister(personal)
antigravpussy
your warm whispers(personal)
Clarke
Multiculturalism(idea)
aneurin
Earl of Landaff(person)
Heitah
Pseudocide(idea)
XWiz
Google Knol(lede)
Mythi
July 24, 2008(personal)
locke baron
The fall of Earth(fiction)
BookReader
Fear the Cold(dream)
Pavlovna
Kathleen MacInnes(person)
stainedglass
1(fiction)
kalen
Three "T"s(idea)
octillion369
Undead(idea)
archiewood
Ico(fiction)
Heisenberg
Why I love Everything2(log)
E2 is a by-product of the existence of The Everything Development Company