Minimize RMSD between two sets of points
I need to plot the transformation of a 3d object against time. I have the 3d shapes for each moment in time, but they are not guaranteed to be geometrically well placed, so I cannot just render them and slap the pictures together into a movie. I therefore need to align them so that they 开发者_StackOverflow社区are pleasantly and consistently oriented with respect to the camera.
What I would do is to take pairs of 3d objects, center them with respect to the geometric center, then perform the proper rotation around some axis so to minimize the RMSD among the points. That's not hard, but I'd enjoy to know if there's something ready out there so not to reinvent the math (and the code). Of course, I'd also accept objections to my method.
I'm working in python, but any code will do, and I will convert it.
The Kabsch algorithm does that. See: http://en.wikipedia.org/wiki/Kabsch_algorithm.
It appears that what I need is the Kabsch algorithm.
精彩评论