3
$\begingroup$

I have a line defined by two points, $q_1$ and $q_2$, and a cloud of three-dimensional points around the line, $Q$.

I rotate, but do not dilate/stretch the line by moving $q_1$ to some $t_1$ and $q_2$ to some $t_2$. In other words, the Euclidean distance between $q_1$ and $q_2$, and between $t_1$ and $t_2$, is the same. How do I correspondingly map the points to this new orientation s.t. their positions relative to the line remain unchanged?

Note that the full set of equations for rotations about an arbitrary axis are provided here: http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/

For convenience, below I provide the Mathematica input for a rotation matrix about an arbitrary axis defined by points $P_1 = (a,b,c)$ & $P_2 = (d,e,f)$, with direction vector $<u,v,w> = (d-a,e-b,f-c)$, where "theta" = $\theta$ is the rotation angle (in radians), and where $L = (u^2+v^2+w^2)$. The three-dimensional point to be rotated is given by $(x,y,z)$.

RotationMatrixArbitraryLine = {((a*(v^2 + w^2) - u*(b*v + c*w - u*x - v*y - w*z))*(1 - Cos[theta]) + L*x*Cos[theta] + L^(1/2)*(-c*v + b*w - w*y + v*z)Sin[theta])/ L, ((b(u^2 + w^2) - v*(a*u + c*w - u*x - v*y - w*z))*(1 - Cos[theta]) + L*y*Cos[theta] + L^(1/2)*(c*u - a*w + w*x - u*z)Sin[theta])/ L, ((c(u^2 + v^2) - w*(a*u + b*v - u*x - v*y - w*z))*(1 - Cos[theta]) + L*z*Cos[theta] + L^(1/2)*(-b*u + a*v - v*x + u*y)*Sin[theta])/L}

The above expression works on the tests I have provided. For example, a $\theta = \frac{\pi}{4}$ degree rotation of the point {0,0,1} about direction vector {1,0,0} maps the point to {0,-1,0}. Changing the direction vector to {0,1,0} maps the same point to {1,0,0}.

$\endgroup$
5
  • $\begingroup$ Note that mapping $q_i$ to $t_i$ only fixes the transformation up to rotations about the line (and mirroring, but I suspect you're looking for orientation-preserving transformations). In other words, it is not uniquely determined where a point should go since you can rotate all of them together about the line. For the sake of clarity: does it matter in your problem which rotation angle about the line is chosen? $\endgroup$ Commented Mar 5, 2013 at 13:49
  • $\begingroup$ @DaanMichiels No it doesn't matter, since $Q$ is actually a set of random points over symmetric space around the line. However, if we're going to aim for something, I suppose it would be to minimize the amount of rotation of the point set? $\endgroup$
    – AffiDavid
    Commented Mar 5, 2013 at 13:53
  • $\begingroup$ I don't see a good way to determine what is "minimal" rotation, as a I don't see a good way to determine the absolute amount of rotation about the line. Indeed, if I did, I would try to come up with a solution having no rotation. I think you can only say that one configuration is rotated so-and-so-much relative to another one, but you cannot measure it absolutely, much like in physics you cannot measure how fast an object moves absolutely, only relative to other objects. I think we should just aim for "the rotation doesn't matter". $\endgroup$ Commented Mar 5, 2013 at 14:00
  • 1
    $\begingroup$ Actually, I think there is a good way of stating which particular rotation you want. You could demand that the axis of rotation is orthogonal to both $(q_2-q_1)$ and $(t_2-t_1)$. $\endgroup$ Commented Mar 5, 2013 at 14:15
  • $\begingroup$ @DaanMichiels That sounds like a perfectly good metric to me. $\endgroup$
    – AffiDavid
    Commented Mar 5, 2013 at 14:28

1 Answer 1

1
$\begingroup$

You are looking for a linear (or affine) isometry which maps $q_1$ to $t_1$ and $q_2$ to $t_2$.

First map $q_1$ to $t_1$. This gives a translation $x\mapsto x + t_1 - q_1$. call this map $T$.

Then the vector $q_2-q_1$ is mapped to $t_2-t_1$. This will be a rotation, which we compute in the following steps -

  1. The vector $u=(q_2-q_1)\times(t_2-t_1)$ (cross product) is perpendicular to the plane spanned by these vectors. Consider $a$ to be the corresponding unit vector. Also let $b$ and $c'$ be the unit vectors in the directions $q_2-q_1$ and $t_2-t_1$. Clearly $a$, $b$ and $c=a\times b$ are a set of orthonormal vectors. We use this basis in place of usual $k$, $i$ and $j$ (note the order).
  2. let us say the angle between $q_2-q_1$ and $t_2-t_1$ is $\theta$. We want to rotate the plane spanned by $b$ and $c$ such that $b$ is rotated towards $c$ by an angle $\theta$. [draw a diagram and the various orientations will be clear]
  3. for any vector $x$, its components along $a$, $b$ & $c$ are $(x.a)a$, $(x.b)b$ & $(x.c)c$. So we can write $$x=\left(\begin{array}{c}x.a\\x.b\\x.c\\\end{array}\right)$$ To write the rotation map we observe that in our chosen basis $$\left(\begin{array}{c}1\\0\\0\\\end{array}\right)\mapsto \left(\begin{array}{c}1\\0\\0\\\end{array}\right)$$ $$\left(\begin{array}{c}0\\1\\0\\\end{array}\right)\mapsto \left(\begin{array}{c}0\\\cos\theta\\\sin\theta\\\end{array}\right)$$ $$\left(\begin{array}{c}1\\0\\0\\\end{array}\right)\mapsto \left(\begin{array}{c}0\\-\sin\theta\\\cos\theta\\\end{array}\right)$$ Write the matrix of that map, call it $M$. I leave that as an exercise.
  4. Now I will write the final rotation map $R$ - $$x\mapsto M(x-t_1)+t_1$$ Where every vector is expressed in our chosen basis. [Work out this final expression as one more exercise]

The final affine map is given by the composition of the two maps translation $T$ followed by rotation $R$. This is not unique. There could be many more maps which will do your job.

$\endgroup$
9
  • $\begingroup$ How do you find the angle $\theta$? $\endgroup$ Commented Mar 5, 2013 at 14:11
  • $\begingroup$ @magguu Could you provide an example to make sure I understand? $\endgroup$
    – AffiDavid
    Commented Mar 5, 2013 at 14:44
  • $\begingroup$ @DaanMichiels $\cos\theta = (q_2-q_1).(t_2-t_1)/\big(\|q_2-q_1\|.\|t_2-t_1\|\big)$ ... actually you do not need $\theta$. you just need $\cos\theta$ and $\sin\theta$. use the sin-cos identity to find it. $\endgroup$
    – magguu
    Commented Mar 5, 2013 at 14:51
  • $\begingroup$ @AffiDavid Take $q_1=0$, $t_1=0$. then there is no translation map. actually figuring out the translation is trivial so i am leaving it out. now take $q_1=(1,0,0)$ and $t_1=(0,1,0)$. clearly you have to rotate the $q$ line towards the $t$ line by $90^{\circ}$. This is all that you need to do in this example. try to draw the points and lines on a black board and it will all be clear. $\endgroup$
    – magguu
    Commented Mar 5, 2013 at 14:56
  • $\begingroup$ @magguu - My point is mainly: how do you find the sign of the sine? (That sounds funnier than anticipated.) $\endgroup$ Commented Mar 5, 2013 at 15:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .