0
$\begingroup$

So I want to rotate the helix $$ \begin{cases} x=\cos(t),\\ y=t,\\ z=\sin(t), \end{cases} $$ so that it wraps ground a vector $(X,Y,Z)^T$. I first get the theta by $$ \theta=\arctan\left(\frac{Z}{Y}\right) $$ Then I use the rotation equation around the $x$-axis. $$ R_x= \begin{bmatrix} 1 & 0 & 0\\ 0 & \cos(\theta) & \sin(\theta)\\ 0 &-\sin(\theta)& \cos(\theta) \end{bmatrix} $$ and multiply $$ R_1=R_x\cdot(\cos(t), t, \sin(t))^T $$ So the rotation here looks fine. Then I do another rotation around the $z$-axis. $$ \phi=2\pi-\arctan\left(\frac{Z}{Y}\right)$$ $$R_z= \begin{bmatrix} 1&0&0\\ 0 &\cos(\phi) &-\sin(\phi)\\ 0 &\sin(\phi) &\cos(\phi) \end{bmatrix}\\$$ $$R_z\cdot R_1$$ The final rotation is in the correct axis, however it does't wrap around the vector; it is slightly off when graphing this in a 3D coordinates system. I wanted to know if I'm using the equations correctly or am I taking the angle of rotation wrong. Thanks!

Also I'm using the vector $(X, Y, Z)^T=(12,13,15)^T$.

Example: first rotation $$ \theta=\arctan\left(\frac{15}{13}\right)=0.85671 $$

$$ R_x= \begin{bmatrix} 1 & 0 & 0\\ 0 & 0.65493 & -0.75569\\ 0 & 0.75569 & 0.65493\\ \end{bmatrix} $$

$$ R_x*helix= \begin{bmatrix} cos(t)\\ 0.6549⋅t - 0.7557⋅sin( t)\\ 0.7557⋅t + 0.6549⋅sin( t) \end{bmatrix} $$

second rotation

$$ \phi=\arctan\left(\frac{12}{13}\right)=0.74542$$

$$ R_z= \begin{bmatrix} 0.73480 0.67828 0\\ -0.67828 0.73480 0\\ 0 0 1\\ \end{bmatrix} $$

$$ R_z*(R_x*helix)= \begin{bmatrix} 0.4442⋅t - 0.5126⋅sin(t) + 0.7348⋅cos(t)\\ 0.4812⋅t - 0.5553⋅sin(t) - 0.6783⋅cos(t)\\ 0.7557⋅t + 0.6549⋅sin(t) \end{bmatrix} $$

Graph: As you can see in the image the helix does not wrap around the vector after doing both the rotations. enter image description here

$\endgroup$
  • $\begingroup$ As described, you have a degree of freedom remaining in the rotation that’s unspecified: after aligning the axes of the helixes you can still apply an arbitrary rotation about the vector $\langle X,Y,Z\rangle$. That aside, the two matrices that you have in your question both represent rotations about the $x$-axis. $\endgroup$ – amd Feb 28 at 7:11
  • $\begingroup$ Please use MathJax to format your mathematical expressions. You can find a quick reference here. In particular, use \langle and \rangle instead of < and > for delimiting vectors. $\endgroup$ – amd Feb 28 at 7:13
  • $\begingroup$ @amd Haha I wrote the incorrectly. $\endgroup$ – Cass.12 Mar 3 at 3:05
  • $\begingroup$ After the first rotation $R_x$ the axis of the helix points in the direction $(0,13,15)$. So after a rotation about the $z$-axis it will point in the direction $(13\sin\phi,13\cos\phi,15)$ for some $\phi$. Not good. I haven't tested but I think the first rotation should make it point in the direction of $(0,\sqrt{12^2+13^2},15)$ instead. Then a rotation about the $z$-axis by an appropriate angle $\phi$ would work. Anyway, as amd pointed out, there is some ambiguity (or a degree of freedom) in the answer. $\endgroup$ – Jyrki Lahtonen Mar 4 at 6:49
  • $\begingroup$ Alternatively, you could use a rotation about the axis $(0,-15,13)$ as the second rotation, but the formula for that is bit more involved. $\endgroup$ – Jyrki Lahtonen Mar 4 at 6:51
2
$\begingroup$

The idea for wrapping a given helix around a given vector is to map the axis of the given helix onto the given vector. Once done this, a degree of freedom remains to establish the rotation of the helix around its axis.

To map the helix axis (let it be $v_0 = (0,1,0)^T$) to the given vector (let it be $v_1 = (X,Y,Z)^T$) a possibility is to use the following two rotations: the first, $R_x$, around the $x$-axis that maps $v_0$ to the right polar angle and the second, $R_z$, around the $z$-axis that adjusts the azimuthal angle (see, e.g., the Wikipedia Spherical coordinate system for an introduction to polar and azimuthal angles).

The rotation $R_x$ describes a counter-clockwise rotation around $x$-axis (viewed from point $(1,0,0)^T$): $$ R_x= \begin{bmatrix} 1&0&0\\ 0&\cos(\phi)&-\sin(\phi)\\ 0&\sin(\phi)&\cos(\phi) \end{bmatrix}, $$ where the angle $\phi$ is the polar angle given by $$ \phi= \arcsin\left(\frac{Z}{\sqrt{X^2+Y^2+Z^2}}\right). $$ The rotation $R_z$ describes a counter-clockwise rotation around $z$-axis (viewed from point $(0,0,1)^T$): $$ R_z= \begin{bmatrix} \cos(\theta)&\sin(\theta)&0\\ -\sin(\theta)&\cos(\theta)&0\\ 0&0&1 \end{bmatrix}, $$ where the angle $\theta$ is the azimuthal angle given by $$ \theta= \arcsin\left(\frac{X}{\sqrt{X^2+Y^2}}\right). $$

We should have, at this point, that $R_z(R_x(v_0)) = v_1$, i.e., the axis of the original helix should have been mapped onto $v_1$, and as a consequence, the new helix should wrap around the given axis.

$\endgroup$
  • $\begingroup$ Thanks! however when using this the helix is not wrapped around the vector there is still some distance between them. Is this just an effect when using this equation? or is there another way to do this. $\endgroup$ – Cass.12 Mar 3 at 2:39
  • $\begingroup$ Assuming that the two rotations were performed correctly, the helix should wrap around vector $(X, Y, Z)^T$. In fact, the two rotations transform rigidly the space $\mathbb{R}^3$ by mapping the old helix axis $(0,1,0)^T$ to the new helix axis $(X, Y, Z)^T$. As suggested by @amd in the comments to your question, there is still a degree of freedom that determines the rotation of the helix around the axis $(X, Y, Z)^T$. If you could post an image of the result you obtain we could try to explain more in detail the "effect" you see... $\endgroup$ – simonet Mar 3 at 7:34
  • $\begingroup$ Hi I posted an image and the result I was getting when plugging in theta and phi. $\endgroup$ – Cass.12 Mar 4 at 6:12
  • $\begingroup$ I'm not sure about your choice of $\theta$ or $\phi$. See my comment under main. The main point is that the second rotation does not change the angle between the axis of the helix and the $z$-axis. The first rotation must adjust that to a correct value. $\endgroup$ – Jyrki Lahtonen Mar 4 at 7:26
  • $\begingroup$ @JyrkiLahtonen I think you are right. I rewrote my answer. $\endgroup$ – simonet Mar 4 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.