Represent motion in three dimensions.
Compare fixed and moving axes, matrix and quaternion descriptions, and the limits of a projected 3D picture.
By the end: Transform points using named 3D frames and explain rotation order, equivalent quaternion signs and angle-coordinate singularities.
Start with something concrete.
Turn a book around one edge, then another. Swap the order. Its final orientation can change even though both turns use the same angles.
Try the interactive model ↓A unit point starts at (0,1,0). Rotate it +90° about fixed world x, then +90° about fixed world y, with no translation. Where does it end?
Change one thing. Watch what follows.
- Compare the same three angles around fixed world axes and moving body axes.
- Change world translation and verify that matrix direction columns stay unchanged.
- Compare projected overlaps with exact coordinate triples.
- Negate every quaternion component and check the unchanged matrix and point.
- Compare the two fixed-world middle-angle-90° presets to reveal nonunique angle coordinates.
- Export an audit naming frames, units, rotation order and component storage order.
Loading this browser experiment…
A book gives you three directions
A planar frame needs two axes; a spatial frame needs three. Imagine a book with one arrow along its long edge, another along its short edge and a third perpendicular to its cover. Those arrows form the body frame B. A separate world frame W remains fixed while you turn the book.
We use a right-handed convention. For a positive rotation, point your right thumb along the positive rotation axis; your curled fingers give the turning direction. Positions and translations use metres. Sliders use degrees, converted to radians for sine and cosine.
Changing orientation is not the same as changing position. The lab rotates a body relative to its own origin and adds the world-coordinate translation afterward. It does not claim to swing a translated object around the world origin.
Specify which axes your turns use
Start with a point at (0,1,0). A positive 90° turn around world x puts it at (0,0,1). A subsequent positive 90° turn around world y puts it at (1,0,0). Reversing these two fixed-axis turns instead leaves the first y turn unchanged and then moves the point to (0,0,1).
A sequence about fixed world axes uses the same x, y and z directions throughout. A sequence about moving body axes uses directions updated by earlier turns. “Rotate x, then y, then z” is therefore incomplete unless the frame convention is stated.
For column vectors, fixed-world x/y/z turns combine as Rz × Ry × Rx: the rightmost matrix acts first. Moving-body x/y/z turns combine as Rx × Ry × Rz. This reversal is bookkeeping for the different physical axis sequence, not a claim that matrix multiplication is commutative.
A matrix records where the body axes point
Put the world-coordinate direction of body x in the first column, body y in the second, and body z in the third. The result is the 3×3 body-to-world rotation matrix R. Multiplying a body-coordinate vector by R combines those three direction columns.
Let p_B be a point in body coordinates and t_W the body origin in world coordinates. Then:
The transpose swaps rows and columns. For a valid rotation it is also the inverse. To invert the point conversion, subtract the translation before applying that inverse. Direction vectors use rotation alone; an origin translation does not change their direction.
Check whether a matrix really is a rotation
Each direction column must have length one, and different columns must be perpendicular. In matrix notation this is RᵀR = I, where I leaves any vector unchanged. Also require determinant +1. A perpendicular unit basis with determinant −1 is a reflection, not a right-handed rotation.
Rotation preserves distances and angles in 3D. Nine arbitrary numbers need not satisfy these constraints. The numerical tests independently check matrix products, determinant, round trips and distance preservation.
A quaternion is another orientation description
A unit quaternion uses four components with squared values adding to one. This lab stores them as (w,x,y,z), with the scalar w first. Some libraries put w last. Always state the ordering when exchanging files.
One way to understand the numbers is an axis and a turn. The axis is a unit direction n, and θ is the rotation angle. The scalar component is cos(θ/2); the other three components are n multiplied by sin(θ/2). The half-angle belongs to this representation; it does not mean the object turns only halfway.
The unit-length constraint leaves three independent numerical degrees of freedom. Opposite signs q and −q represent the same orientation: toggle the sign checkbox and inspect the unchanged matrix and point. These values are not probabilities, and a negative component is not an invalid direction.
An identity rotation has no unique axis. At a 180° turn, opposite axis directions also describe the same orientation. The axis-angle display chooses a principal angle from 0° to 180° and labels the identity axis undefined. This choice does not make the representation globally unique.
Composition and inversion still need conventions
Quaternion multiplication can compose rotations while keeping their representation compact. It is not ordinary component-by-component multiplication and is generally not commutative. The implementation normalizes nonzero quaternions and rejects zero; it compares the resulting orientation rather than raw components.
For a unit scalar-first quaternion, keeping w and negating only (x,y,z) gives its inverse. That differs from negating all four entries, which preserves its orientation. A quaternion describes rotation, not translation; the point transform still needs a separate origin vector.
Three-angle coordinates can become nonunique
Use the fixed-world x/y/z sequence at (0°,90°,0°). Then try (30°,90°,30°). These produce the same orientation. At the 90° middle angle, two of the angle-coordinate effects become dependent. This is a representation singularity often called gimbal lock.
The object has not physically lost a dimension. The problem is this particular set of three coordinates for orientation. Matrices and unit quaternions still represent the orientation, but they do not remove a robot mechanism’s physical singularities, constraints or collisions. The Jacobian lesson will address a different question: how joint changes affect motion.
Do not measure 3D truth from a flat drawing
The lab uses a fixed orthographic projection, with all box edges visible. It discards depth along the viewing direction (1,1,1). Different 3D points can overlap in the picture; projected edge lengths and angles need not equal their spatial values.
Use the exact triples, matrix and orientation difference to decide whether the frames agree. Even a matching transformed point is insufficient: both rotations leave the local origin at the translated body origin, while their axes can disagree.
Report a pose contract, not a motion guarantee
A guided audit predicts a quarter-turn and checks the numeric result. An implementation audit compares independently written axis matrices and quaternion products, including identity, half-turn, sign and nonunique-angle cases. A decision brief states units, frames, composition order and file component conventions.
This is rigid-pose practice, not a trajectory planner. It does not simulate forces, interpolation, collisions or physical robot operation. Three temporary audit captures export the values; independent implementation review and learner pilots remain pending.
Two files contain unit quaternions q and −q, with the same scalar-first convention. What should an orientation comparison conclude?
Take this idea with you.
3D orientation needs a declared frame and composition convention. Matrices and unit quaternions can describe the same rotation; neither makes motion dynamically feasible or collision-free.