# Finding an appropriate axis of rotation for two points such that they can be rotated and translated to overlay a given line

I have two lines with known parametric equations and some number of distinct points along each line. I would like to rotate the points on $L_2$ some number of degrees $\theta$ along one and only one line $L_{map}$ s.t. that the set of points in $L_2$ can be translated to lie along $L_1$. Performing such a rotation on a set of points is straightforward, but how do I find $L_{map}$ and the rotation angle $\theta$ as a function of $L_1$ and $L_2$?

[1/3/2012] - To reduce the size of the solution set of lines satisfying the constraints for $L_{map}$, we can split $L_1$ and $L_2$ into two sets of parallel lines spaced the same distance apart, and ask for some line $L_{map}$ that allows one to overlay the two sets of parallel lines by translation.

-
How many dimensions are you working in? – Henry Jan 2 '12 at 9:13
@Henry Sorry for the delayed response. I'm working in three dimensions. – Steve Jan 2 '12 at 17:52

Let $\vec v$ be the cross-product of the direction vectors of $L_1$ and $L_2$. As long as $L_1$ and $L_2$ are not already parallel, $\vec v$ will be non-zero. I assert that $\vec v$ is the direction vector of $L_{map}$.

Now, take the plane formed by $L_{map}$ and $L_2$ and find the unique point $\vec x_0$ where it intersects with $L_1$. This will be a point on $L_{map}$.

So you can then define $L_{map} = \vec x_0 + \vec v t$.

The angle of rotation $\theta$ is determined by taking the dot product of the direction vectors, since $$\vec u \cdot \vec v = |\vec u||\vec v| \cos \theta.$$

If you're doing this algorithmically, there's a slight hitch since you have two solutions, $\pm\theta$, from solving for $\cos \theta$. The blunt way from here is to try both, and keep the solution where the resulting direction vector's dot product with the direction vector of $L_1$ is higher.

-

Your two lines define a plane. If you rotate around any line perpendicular to that plane, you'll then be able to translate. If you're working in 3D you can find a perpendicular by taking the cross product of the direction vectors of the two lines.

-
I apologize for the delay, but yes, I'm working in three dimensions. How though does one find the rotation angle? – Steve Jan 2 '12 at 17:54
If the two lines define a curved plane in 3D, it's not clear to me that rotating around an arbitrary perpendicular line to the plane will allow for overlay by translation? – Steve Jan 2 '12 at 18:03
@Steve, a curved plane? So when you say "lines" you actually mean "curves"? – Peter Taylor Jan 2 '12 at 18:08
I shouldn't have said "curved", I meant a set of lines where one can pick two points on each line to represent a non-planar surface. – Steve Jan 2 '12 at 18:15
In this image of a cube (yaroslavvb.com/blog/ecc/hamming3.png), for example, let L1 be the line passing through the top two red vertices, and let L2 be the line passing through the bottom two red vertices. – Steve Jan 2 '12 at 18:19