2
$\begingroup$

What I am trying to achieve

Firstly, this is just for fun and has no real world purpose.

I am trying to create a plot of a helix that is perpendicular to a curve. The helix is defined by a parametric equation (see below). The helix looks almost like I wanted it to (see plots below). However, there is something wrong with my equation that causes some imperfections in certain areas of the helix (see 2D plot).

Plot: 2D view

2D plot

Plot: 3D view

3D plot

Equation for basic curve

This is the equation for the basic curve that the helix should go around. This equation produces the desired plot. In the plot it is represented by the orange line. $$ t=[0,2\pi[\\ r_1=5\\ \omega _1=1\\ r_2=2\\ \omega _2=7\\ r_3=0.5\\ \omega _3=500\\ \\ \begin{pmatrix} x\\ y\\ z\\ \end{pmatrix} = \begin{pmatrix} r_1\cdot cos(\omega_1\cdot t)+ r_2\cdot cos(\omega_2\cdot t)\\ r_1\cdot sin(\omega_1\cdot t)+ r_2\cdot sin(\omega_2\cdot t)\\ 0 \\ \end{pmatrix} $$

Equation with the helix

This is the equation for the helix (represented by the blue lines in the plots). It produces mostly the curve that I am trying to achieve. However the helix is not everywhere exactly perpendicular to its centre (basic curve, see above). I think this is due to the red part of the equation. $$ \begin{pmatrix} x\\ y\\ z\\ \end{pmatrix} = \begin{pmatrix} r_1\cdot cos(\omega_1\cdot t)+ r_2\cdot cos(\omega_2\cdot t)+ r_3\cdot cos(\omega_3\cdot t) \color{red}{\cdot cos(\omega_2\cdot t)}\\ r_1\cdot sin(\omega_1\cdot t)+ r_2\cdot sin(\omega_2\cdot t)+ r_3\cdot cos(\omega_3\cdot t) \color{red}{\cdot sin(\omega_2\cdot t)}\\ r_3 \cdot sin(\omega_3 \cdot t) \\ \end{pmatrix} $$ Question

How do I need to change the red part of the equation in order to get a helix that is always perpendicular to its centre?

$\endgroup$
3
  • 1
    $\begingroup$ The word spiral is not the right scientific word. You should call it a (generalized) helix. $\endgroup$
    – Jean Marie
    Commented Nov 3, 2016 at 22:36
  • $\begingroup$ Besides, nice work [+1] $\endgroup$
    – Jean Marie
    Commented Nov 3, 2016 at 22:40
  • $\begingroup$ Yes, of course you are absolutely right 'spiral' is not the right term. $\endgroup$ Commented Nov 3, 2016 at 23:08

1 Answer 1

6
$\begingroup$

Let us denote your original curve by a vector function $\vec{p}$. Thus,

$$\vec{p}(t) = \begin{pmatrix} x(t)\\ y(t)\\ z(t)\\ \end{pmatrix} = \begin{pmatrix} r_1\cdot \cos(\omega_1\cdot t)+ r_2\cdot \cos(\omega_2\cdot t)\\ r_1\cdot \sin(\omega_1\cdot t)+ r_2\cdot \sin(\omega_2\cdot t)\\ 0 \\ \end{pmatrix}. $$ With this notation, the vector $\vec{p}'(t)$ obtained by differentiating componentwise $$\vec{p}'(t) = \begin{pmatrix} x'(t)\\ y'(t)\\ z'(t)\\ \end{pmatrix} $$ is tangent to the curve. Since your curve is contained in the plane, an easy way to obtain a vector perpendicular to the curve is to compute the cross product of $\vec{p}'$ with $\langle 0,0,1\rangle$. Using this, I obtained the unit normal vector $$ \vec{N}(t) = \begin{pmatrix} \frac{r_1 \omega _1 \cos \left(t \omega _1\right)+r_2 \omega _2 \cos \left(t \omega _2\right)}{\sqrt{2 r_1 r_2 \omega _2 \omega _1 \cos \left(t \left(\omega _1-\omega _2\right)\right)+r_1^2 \omega _1^2+r_2^2 \omega _2^2}}\\\frac{r_1 \omega _1 \sin \left(t \omega _1\right)+r_2 \omega _2 \sin \left(t \omega _2\right)}{\sqrt{2 r_1 r_2 \omega _2 \omega _1 \cos \left(t \left(\omega _1-\omega _2\right)\right)+r_1^2 \omega _1^2+r_2^2 \omega _2^2}}\\0 \end{pmatrix}. $$

At this point, your spiral (or, helix, really) can be parametrized by the vector function

$$\vec{p}(t) + r_3 \vec{N}(t)\cos(\omega_3 t) + r_3 \langle 0,0,1\rangle\sin(\omega_3 t).$$

Using your parameters, this produces the following pictures:

enter image description here

enter image description here

$\endgroup$
3
  • 2
    $\begingroup$ As I just wrote to the OP, the word (generalized) "spiral" should be replaced by (generalized) 'helix". $\endgroup$
    – Jean Marie
    Commented Nov 3, 2016 at 22:38
  • 1
    $\begingroup$ @JeanMarie Yes, I agree. $\endgroup$ Commented Nov 3, 2016 at 22:39
  • $\begingroup$ Very nicely worked out answer! Unfortunately I can't yet up-vote :-( $\endgroup$ Commented Nov 3, 2016 at 23:13

You must log in to answer this question.

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