This is about how to factor (decompose) a single 3D rotation into two component rotations at right angles to each other. One component is a swing of the direction vector to a new direction and the other component is a twist about the direction vector.

This is potentially useful where we might want to apply constraints to the rotation, for instance a robot arm, there may be a mechanical limitation on the angle through which it will twist.

First I would like to define how we are breaking down this rotation into a set of joints,

Is it a rotating joint and then a hinge, or is it a hinge and then a rotating joint, or are these two equivalent?

Could we replace either of these by 2 hinges offset from each other? provided that one of them is inline with the hinge of the other.

I was originally assuming that swing and twist was represented by type 2 with the swing being represented by the hinge and the twist being represented by the rotating joint, however the revolute joint is shown as type 1.

These joints only have 2 degrees of freedom, so to represent any rotation we need to replace the hinge with a ball and socket joint, or we need to have the rotating joint both before and after the joint. More on joint types here.

From the diagram above define the following vectors:

- D=original vector direction
- N=new vector direction
- A=axis of swing rotation
- R=axis of combined rotation

The twist is around the direction vector, we could apply the twist about D first and then apply the swing, or apply the swing and then twist about N, or even apply the swing and twist simultaneously so if we define the following corresponding quaternions:

- QD = twist about D (if twist is done before swing)
- QN = twist about N (if twist is done after swing)
- QS = swing rotation
- QR = complete rotation

So using these definitions:

QR = QS * QD= QN * QS

note: I'm not saying here that the rotation compositions are commutative, all I'm saying is that the rotation could be decomposed into the swing(QS) first and then the twist(QN) or by the twist(QD) first and then the swing(QS). This is not commutative because QD != QN.

## derivation of decomposition from minorlogicLet Us take by Twist quaternion the quaternion of look |

## Example

Here is an example to illustrate swing & twist, aiming the dish (elevation & azimuth) is the swing, and the polarisation of the signal (vertical or horizontal) is the twist.