I have been scratching my head for days trying to answer this question.
Suppose i have 2 points on three-dimensional space, say, $A(x_1, y_1, z_1)$ and $B(x_2, y_2, z_2)$, and they are separated by a distance $d$. Also, imagine i have a very thin cylinder, whose height is also $d$ (for this purpose, it may as well be thought of as a line). His center of mass is located exactly on point $A$. My question is: how do i go about calculating the offsets in the cylinder's position (supposing that "the cylinder's position is $(a, b, c) $" means "the cylinder's center of mass, assuming constant density, is located at $(a, b, c)$"), as well as (most importantly) the set of rotations necessary so that one end of the cylinder is located at $A$ and the other end is located at $B$?
I say the rotations are the most important, because i suppose it is clear that the cylinder's center of mass should be positioned exactly between $A$ and $B$, so it's center of mass position should be $(\frac{x_2 - x_1}{2}, \frac{y_2 - y_1}{2}, \frac{z_2 - z_1}{2})$. But how to calculate the set of rotations around the $x, y$ and $z$ axis?
I suppose quaternions should help me on that, but i have never studied them. Is there another way around?
Thanks in advance, folks!
The initial orientation of the cylinder is of some significance. But whatever it is, the following sequence of rotations works:
After these rotations, the translation that you described bring the cylinder to the desired position.