Explain 3D rotation parametrizations and their pros and cons
Role: Data Scientist
Category: Statistics & Math
Difficulty: medium
Interview Round: Other
Explain the common ways to parametrize a 3D rotation and the pros and cons of each. Say when you would pick one over another, for example to compose rotations, to interpolate between two orientations, or to let a person read and enter angles.
```hint Count the numbers
A rotation has three degrees of freedom. Compare that with how many numbers each form stores, and ask what keeps any extra numbers consistent.
```
```hint Stress test each form
For each representation, try composing two rotations and interpolating halfway between two orientations. Then look for orientations where the representation stops being well defined.
```
### What a Strong Answer Covers
- The main parametrizations and how many numbers each uses for three degrees of freedom
- How each one composes rotations, rotates a vector, and interpolates
- Singularities and ambiguities: gimbal lock, undefined axes, double cover, and numerical drift
- A reasoned choice of representation for storage, computation, interpolation and human input
### Follow-up Questions
- Show gimbal lock concretely for yaw, pitch and roll angles. Which pitch causes it, and what is lost?
- Why do you sometimes negate one quaternion before running slerp?
- How would you average a set of noisy orientation estimates?
- A neural network must predict an object's 3D orientation. Which representation would you use as its output, and why?
Overview: Asks for the main ways to represent a 3D rotation, from rotation matrices and Euler angles to axis-angle and unit quaternions, and the trade-offs of each. Tests composition, interpolation, gimbal lock, numerical drift and choosing a representation for a given job.