# Torus-cylinder intersection.

The standard equation for a torus rotated about the $z$ axis is: $$(x^2+y^2+z^2+R^2-r^2)^2 = 4R^2 (x^2+y^2)$$

The cylinder of interest is parallel to the $x$ axis and offset along the $y$ axis by $R$:

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

I'm trying to evaluate some function $H(x,y,z)$ over the surface created by the intersection of a torus and a cylinder as in http://i.imgur.com/s2pNZ6R.png. I'm aware that a solution exists (https://mathematica.stackexchange.com/questions/5968/plotting-implicitly-defined-space-curves), but I can't find a solution where the result is actually written fully.

From the intersection curve, I'm planning to find the ''shadow region'' $D$.

I'd like to evaluate the integral using the following standard surface integral method,

$$\int \int_S H(x,y,z) d \sigma = \int \int_D H(x,y,z) \frac{|{\nabla F}|}{|\nabla F\cdot p|} dA$$

I cannot manage to find intersection curve. My first three attempts just hung in both Maple and Matlab when trying to evaluate the integral.

If I've understood well you need to find the equation of the intersection curve between a torus and a cylinder (I'll call it $tc$) defined by the following equations:

Torus: (1) $\,\,\,(x^2+y^2+z^2+R^2-r^2)^2=4 R^2 (x^2+y^2)$

Cylinder: (2) $\,\,\,z^2 + (y - R)^2= r^2$

(BTW, according to your figure are you sure it's not $z^2 + (y + R)^2= r^2$ ? anyway little changes in what follows)

You can isolate $z^2$ in the equation (2) and put it in the equation (1).

With some simplification you'll get

$x^2(x^2+4Ry-4R^2)=0$

That is

(3) $y = - \frac{{{x^2}}}{{4R}} + R$

This means that the projection of the $tc$ curve on the $x$y plane is a simple parabola.

After that you can put equation (3) into equation (2) and get (4): ${z^2} = - \frac{{{x^4}}}{{16{R^2}}} + {r^2}$

That's the projection of the $tc$ curve in the $xz$ plane. It's a quartic curve.

Your $tc$ curve in space can then be defined as the intersection of the surfaces defined by equations (3) and (4) where the first is the surface generated by translating the parabola of the $xy$ plane along the $z$ axis and the second is generated by translating the quartic curve of the $xz$ plane along the $y$ axis.

The parametric equations of the $tc$ curve are then

$\begin{array}{*{20}{l}} {x = t}\\ {y = - \frac{{{t^2}}}{{4R}} + R}\\ {{z} = \pm \sqrt { - \frac{{{x^4}}}{{16{R^2}}} + {r^2}} } \end{array}$

If you're interested you can also derive the projection of the intersection curve in the $yz$ plane. I think you'll get a semicircle.

I hope this helps

[I suggest to add the tags "solid-geometry" and "3D" to your original post]

Luca