Transformations - continued

Matrices are also useful for rotating a point (an object) about an arbitrary axis (not parallel to X or Y or Z) situated at an arbitrary point in space (ie not at the origin).

In addition, certain types of deformations can be compactly expressed as matrices. Here is more on this topic.

Onscreen

Print

Extra refs. for rotation about an arbitrary axis, 7-matrices version:

This is a lecture from Columbia's Fall '05 CS4160 CG intro. class. Look at the last couple of slides for a rotation formula equivalent to our `rot(a) = cos(theta)(a\\r) + sin(theta)(rxxa) + (a.r)r`

Here is extra explanation for how we derive our formula for arbitrary rotation. Please refer to slides #5 and #6 in the onscreen PDF and this diagram.

Problem statement: given an axis `r` (not parallel to X or Y or Z in general) and a point `a`, what is the new point `a'` that results when `a` is rotated about `r` by an angle `theta`?

Note that `r` is a unit (normalized) vector - it is simply is an axis for rotating (it is a direction), so has unit length by default. The formula we seek is of the form

`a' = rot(a) = f(a,r,theta)`

As a check, when `theta` is 0 we should get `a'=a`, ie. the point stays as-is unrotated.

Before we proceed, let's create an orthonormal system (X-Y-Z-like axes, mutually perpendicular) `[hat(e_1) hat(e_2) hat(e_3)]` to use in our derivation. `e_3` is easy, it is simply `r` which is already normalized. Define `e_1` to be `((a\\r))/|(a\\r)|`, where `a\\r` is the projection of `a` on to `r`. Recall that `a\\r` is by definition perpendicular to `r`, which makes `e_1` perpendicular to `e_3`. We have `e_3` and `e_1` that are perpendicular, and to get `e_2` we simply take their cross product (which by definition will be perpendicular to the vectors being crossed): `e_2 = e_3xxe_1`.

Start by observing that we're going to 'spin' `r` as it it were a rod, by an angle `theta`. If the point `a` is at the tip of a rod welded/glued perpendicular to `r` (the 'rod' is `a\\r` of course), spinning `r` will make `a` trace out a circle (the base of an upside down cone, in the diagram). Our new `a'` will lie on this circle (location depending on `theta`). `a` can be broken down into two (perpendicular components): one along `r` which *doesn't* change as `r` spins, another perpendicular to `r` which does.

`a = a\\r + alpha r`, where `alpha` is a fraction resulting from projecting `a` on to `r`. Specifically, `alpha = ((a.r)/(r.r))`. Since `r.r=1` (`r` is a unit vector), `alpha` simply is `a.r`.

`a`, `a\\r` and `alpha r` form a vector triangle, which must remain one when rotated:

`rot(a) = rot((a\\r) + (alpha r)) = rot(a\\r) + rot(alpha r)`, where 'rot' denotes spinning axis `r` by angle `theta`.

As noted above, spinning `r` doesn't affect its own self, so `rot(alpha r)` becomes `alpha rot(r)` which is just `alpha r`. Likewise, `a\\r` is `|a\\r|e_1`, so our rotation formula is now

`rot(a) = |a\\r|rot(e_1) + alpha r`

Now for a fun observation: When we spin `e_3` (our axis `r`), the perpendicular vectors `e_1` and `e_2` spin along (tracing out a circle). What does this do to `e_1`? It makes it trace a path over to former `e_2`. In other words, the new location `e_1^'` which is along the circle trajectory is a non-linear combination of `e_1` and `e_2`:

`rot(a) = |a\\r|(e_1 cos(theta) + e_2 sin(theta)) + alpha r`

`rot(a) = cos(theta)|a\\r|e_1 + sin(theta)|a\\r|e_2 + alpha r`

`rot(a) = cos(theta)(a\\r) + sin(theta)(rxxa) + alpha r`

The above results from:

`a\\r = |a\\r|e_1` [from the definition of `e_1`]

`rxxa = rxx(|a\\r|e_1 + alpha r) = rxx(|a\\r|e_1 + (r.a)r) = |a\\r|(rxxe_1) + (r.a)rxxr = |a\\r|e_2 + 0 = |a\\r|e_2`

Finally, knowing that `alpha = a.r`, our desired result is

`rot(a) = cos(theta)(a\\r) + sin(theta)(rxxa) + (a.r)r`

The above formula for rotation about an arbitrary axis is called 'Rodrigues' Formula'.