# Finding the center of rotation in 3d knowing the start/end transformations

I need your help to solve a trigonometry problem, I'm unable to find any documentation about on the web...

For convenience, I will use "transform" to indicate a position+orientation.

Let's say that we have a general shape (the green box) and we apply to it a displacement and a rotation to obtain the blue box (the grey box represents a possible interpolation between the initial and the final transform)

Now, suppose that the transform we apply produce this result. To match the blue box transformation we could simply apply a rotation to the green box with the center represented by the orange dot.

The question is the following: Is it possible to compute the center of rotation for any generic case knowing only the transformations of the green and the blue box? Ex:

Why this need? Consider the image n2, if I simply interpolate [0,5] the transformation of the green and the blue box I obtain the grey box of the image n1, what I'm looking for is a way to obtain the grey box of the image n2.

Thank you so much!

• Do you have a transformation matrix from green to blue, or do you have only the initial and final positions of the vertex? Dec 21, 2022 at 21:57
• I have the orientation matrices (so the box x,y,z axes oriented in the world) of the green and the blue box and their positions ... Dec 22, 2022 at 19:28
• From the orientation matrices, it is a simple coplaner projection to get a line, line intersection point, calculate the 2 angles and radius, average the two angles and give the projection of the grey object's position.
– user122973
Dec 23, 2022 at 5:20
• The key term is co-planar. Assuming you want the shortest answer or the longer one as there are 2 for all orientations, except the following: the only ambiguity of the median is if the blue and green boxes are co-linear either 0 degrees to which there is no answer, or 180 degrees to which the the answers lay on disc perpendicular to the center.
– user122973
Dec 23, 2022 at 5:43
• @Strom, It's hard for me to understand your response and apply your solution. I have to "co-plane project" the two matrices? What line I get? What point I have to intersect with that line? ... Maybe you can provide me a more explicit example? Thank you Dec 23, 2022 at 17:40

## 1 Answer

I'm afraid it's not quite possible, simply because there is always more than one solution. For example, even if we know the rotation center, you can get the same final pose by rotating in different ways:

But even using different points as rotation center can work as well:

So, in order to automate this process, you would have to introduce additional constraints (like, for example, fix the direction in which you want to rotate). The specifics of how to solve it then would depend on which constraints you choose and how you define the positions and orientations.

• These transformations all match the green box's vertices to the blue box, but in different orientations. If we distinguish the sides of the boxes in some way — say making one end wider and putting a bump on one face — then only one of these transformations will being them into alignment, and the others will mismatch which side is flared/bumped. Viewed another way, if we have the boxes expressed as a translation vector and an orientation quaternion, there's exactly one shortest rotation that maps the first orientation to the second (or two if they're exactly 180 degrees apart). Dec 22, 2022 at 12:19
• That's a good point! Dec 22, 2022 at 14:36
• Thank you both! So it's maybe possible to find that shortest rotation with some calculation? The double result of the 180° case will not be a problem... Dec 22, 2022 at 19:22
• This is over thought. The first rotation of the top image is an arbitrary spherical rotation.
– user122973
Dec 23, 2022 at 5:48