# Solving intersection of translated spiric curve

The spiric section is the curve obtained by slicing a torus along a plane parallel to its axis. Assume the torus midplane lies in the $z=0$ plane, $a$ is the radius of the torus tube and $c$ is the distance from the origin of the center of the tube.

Now cut the torus with the plane $y = r$ and we get the curve:

$$z^2=a^2-(c-\sqrt{x^2+r^2})^2$$

I'm interested only in the bottom part:

$$f(x)=z=-\sqrt{a^2-(c-\sqrt{x^2+r^2})^2}$$

And more specifically I'm trying to find the horizontal position of the intersection between $f(x)$ and a translated copy $q+f(x+p)$ (with $p$ and $q$ integers), in other words:

I want to solve the following equation for $x$, symbolically if possible:

$$q - \sqrt{a^2 - (c - \sqrt{(p - x)^2 + r^2})^2} + \sqrt{a^2 - (c - \sqrt{r^2 + x^2})^2} = 0$$

(in the appropriate domain where square roots are real)

Note: I don't have a lot of experience with math software, but I have tried both SageMath and WolframAlpha, and wasn't able to get a closed form solution, although WolframAlpha can solve the case where $c=0$:.

• I guess that this is reducible to a cubic problem, hence it should have an analytical solution. – Yves Daoust May 19 '17 at 16:26
• Hmm I believe there should be two cases, a simple quadratic one when the intersection is between the outer sides of the torus, and a more complicated quartic otherwise. – Giovanni Funchal May 20 '17 at 7:49
• No, there is no reason for the degree of the problem to change. – Yves Daoust May 20 '17 at 13:53
• I was thinking that the case of swept half-circle (instead of full-circle) was easier and only quadratic, but I now think you are correct. – Giovanni Funchal May 24 '17 at 15:12
• There is no difference between a curve and a half curve, because the implicit equation doesn't know. – Yves Daoust May 24 '17 at 16:39

The implicit equation of the torus is

$$(x^2+y^2+z^2+R^2-r^2)^2=4r^2(x^2+y^2)$$

and the parametric equation of the shifted one is

$$\begin{cases}x=(R+r\cos\theta)\cos\phi+p\\y=(R+r\cos\theta)\sin\phi\\z=r\sin\theta+q.\end{cases}$$

The sections are given by

$$y=Y$$ and by eliminating $\theta$, $$R+r\cos\theta=Y\csc\phi,\\ \\ x=Y\cot\phi+p,\\z=q\pm\sqrt{r^2-\left(Y\csc\phi-R\right)^2}.$$

Then plugging one into the other,

$$\left((Y\cot\phi+p)^2+Y^2+\left(q\pm\sqrt{r^2-\left(Y\csc\phi-R\right)^2}\right)^2+R^2-r^2\right)^2=4r^2((Y\cot\phi+p)^2+Y^2).$$

We can rationalize with $\csc\theta=\dfrac{1+t^2}{2t}$ and $\cot\theta=\dfrac{1-t^2}{2t}$, giving

$$\left(\left(Y\dfrac{1-t^2}{2t}+p\right)^2+Y^2+\left(q\pm\sqrt{r^2-\left(Y\dfrac{1+t^2}{2t}-R\right)^2}\right)^2+R^2-r^2\right)^2=4r^2\left(\left(Y\dfrac{1-t^2}{2t}+p\right)^2+Y^2\right),$$

or, multiplying by $16t^4$,

$$\left(\left(Y(1-t^2)+2pt^2\right)^2+4(Y^2+R^2-r^2)t^2+\left(2qt\pm\sqrt{4r^2t^2-\left(Y(1+t^2)-2Rt\right)^2}\right)^2\right)^2=16r^2\left(\left(Y(1-t^2)+2pt\right)^2+4Y^2t^2\right)t^2.$$

It is possible to turn this equation in a polynomial one after leeennnngthy computation to eliminate the square root.

• I can't figure out the last step ie eliminating the square root. – Giovanni Funchal May 22 '17 at 10:47
• Expand the squares and put the expression in the form $\pm P(t)\sqrt{Q(t)}=R(t)$. Then $P^2(t)Q(t)=R^2(t)$. This is more than nasty. – Yves Daoust May 22 '17 at 10:51