Interpolations, matching and more

Now that a major chunk of the work has been done, I am making pull requests directly into the main scipy repository. This next phase of the project consitsts of rotation estimation and interpolations.

Wahba’s problem

Wahba’s problem is figuring out the rotation that maps one frame to another. Given a set of vector observations in two different frames, the new `Rotation.match_vectors` function returns the best estimate of the rotation that maps one to the other. This is often used to determine the orientation of spacecraft which only have stationary distant stars as reference.

The implementation will be completed within the next week and merged into the main repository.

Error bound based on input noise

While the estimation itself was pretty simple (the SVD method has been used for estimation) the major chunk of the work involved reading papers and figuring out how to give the user and estimate of the ‘correctness’ of the returned rotation. For this purpose, we also return a sensitivity matrix which is the [scaled] covariance matrix of the three component error vector expressed as a rotation of the initial frame.

I realise that’s a mouthful. In simple terms, the attitude error along each axes is treated as a random variable and the covariance matrix of these 3 random variables is computed.


Another useful aspect of having a rotation module is the ability to interpolate between orientation without having to specify all of them. This can easily be useful for 3D animation and simulations.

Two kinds of interpolations are supported:

Spherical Linear Interpolation

This is the ‘shortest-path’ equivalent along a 3D sphere. This leads to an orientation change with constant velocity between two successive keyframes.

Unfortunately, this often leads to a jerky motion at the keyframe endpoints when the angular velocity suddenly changes and the alternative is often preferred.

Spline Interpolation

Instead of using a linear function for interpolation, a spline (a polynomial of degree 3) is used. This has the additional benefits that we can choose the interpolation polynomial so as to ensure a continuous change in the angular velocity and acceleration at all times during the interpolation. This does not lead to the shortest path, but leads to an overall smooth orientation change.

This PR will also be merged in the coming week.

Next steps

As we head into these last few days of GSoC I plan to complete the two remaining pull requests and write a tutorial show casing the capabilities of this new module. Stay tuned!

Leave a Reply

Your email address will not be published. Required fields are marked *