Here we define the rotation in terms of what does change, that is the two dimensional plane within which points move as they rotate. We will factor the rotation into the following steps:
- Move point along perpendicular line to the plane which goes through the origin.
- Do simple 2 dimensional rotation in the plane.
- Move point back along the perpendicular line to the same distance from the plane that it was originally.
This method seems to work best when using matrices. I don't think this method will work properly for compound rotations in 4 dimensions and above since we need to take into account the quadvector and other even blades generated (see this page for the issues concerning higher dimension rotations).
Working
To map a three dimensional space onto a two dimensional in a linear way we can use two basis vectors:
basis1 |
basis2 |
where:
- basis1 = (b1x,b1y,b1z) = 3D vector in plane of rotation toward initial position of point projected onto plane.
- basis2 = (b2x,b2y,b2z) = 3D vector in plane of rotation perpendicular to initial position of point.
Each of these basis vectors are 3 dimensional so this gives a 3×2 matrix:
b1x | b1y | b1z |
b2x | b2y | b2z |
When a 3 dimensional vector is multiplied by this matrix the result is a two dimensional matrix. So this transforms points in three dimensional space to points in a two dimensional space:
x' y' |
= |
|
x y z |
What if we want to go in the opposite direction? That is, we want to map from a two dimensional space to a three dimensional space?
In that case we just transpose the row and columns of the matrix to give:
basis1 | basis2 |
Which is a 2×3 matrix:
b1x | b2x |
b1y | b2y |
b1z | b2z |
So this transforms points in two dimensional space to points in a three dimensional space:
x' y' z' |
= |
|
x y |
We can also map points, which remain in 3D space, but move to the plane in a direction perpendicular to the plane, that is they move to the nearest point on the plane. To do this we combine the previous two transforms:
|
|
we can expand this out to:
|
|
multiplying out gives:
b1x2 + b2x2 | b1x*b1y + b2x*b2y | b1x*b1z + b2x*b2z |
b1x*b1y + b2x*b2y | b1y2 + b2y2 | b1z*b1y + b2z*b2y |
b1x*b1z + b2x*b2z | b1z*b1y + b2z*b2y | b1z2 + b2z2 |
We can use the following notation for this:
P2 = P1 || plane
This means P2 is the component of P1 which is perpendicular to the plane.
Perpendicular to plane
See this page for full introduction to Parallel and Perpendicular components of planes.
We can also calculate the component of P1 which is perpendicular to the plane, this is denoted as follows:
P2 = P1 plane
If we add the parallel component and the perpendicular component we get the original vector as follows:
P1 = P1 || plane + P1 plane
Canceling out P1 gives:
[I] = || plane + plane
where [I] is the identity matrix.
We can therefore calculate the perpendicular component as follows:
plane = [I] - || plane
So in terms of the matrix elements this is:
|
- |
|
which gives:
1 - b1x2 - b2x2 | - b1x*b1y - b2x*b2y | - b1x*b1z - b2x*b2z |
- b1x*b1y - b2x*b2y | 1 - b1y2 - b2y2 | - b1z*b1y - b2z*b2y |
- b1x*b1z - b2x*b2z | - b1z*b1y - b2z*b2y | 1 - b1z2 - b2z2 |
Rotate in Plane
We can also rotate in a given plane, first we translate to a 2D plane, then we rotate, then translate back to 3D, as follows:
x' y' z' |
= |
|
|
|
where:
- basis1 = (b1x,b1y,b1z) = 3D vector in plane of rotation toward initial position of point projected onto plane.
- basis2 = (b2x,b2y,b2z) = 3D vector in plane of rotation perpendicular to initial position of point.
Multiplying out the right hand terms gives: