# Sphere–cylinder intersection

(Redirected from Sphere-cylinder intersection)

In the theory of analytic geometry for real three-dimensional space, the intersection between a sphere and a cylinder can be a circle, a point, the empty set, or a special type of curve.

For the analysis of this situation, assume (without loss of generality) that the axis of the cylinder coincides with the z-axis; points on the cylinder (with radius ${\displaystyle r}$) satisfy

${\displaystyle x^{2}+y^{2}=r^{2}.}$

We also assume that the sphere, with radius ${\displaystyle R}$ is centered at a point on the positive x-axis, at point ${\displaystyle (a,0,0)}$. Its points satisfy

${\displaystyle (x-a)^{2}+y^{2}+z^{2}=R^{2}.}$

The intersection is the collection of points satisfying both equations.

## Trivial cases

### Sphere lies entirely within cylinder

If ${\displaystyle a+R, the sphere lies entirely in the interior of the cylinder. The intersection is the empty set.

### Sphere touches cylinder in one point

If the sphere is smaller than the cylinder (${\displaystyle R) and ${\displaystyle a+R=r}$, the sphere lies in the interior of the cylinder except for one point. The intersection is the single point ${\displaystyle (r,0,0)}$.

### Sphere centered on cylinder axis

If the center of the sphere lies on the axis of the cylinder, ${\displaystyle a=0}$. In that case, the intersection consists of two circles of radius ${\displaystyle r}$. These circles lie in the planes

${\displaystyle z=\pm {\sqrt {R^{2}-r^{2}}};}$

If ${\displaystyle r=R}$, the intersection is a single circle in the plane ${\displaystyle z=0}$.

## Non-trivial cases

Subtracting the two equations given above gives

${\displaystyle z^{2}+(r^{2}-R^{2}+a^{2})=2ax.}$

Since ${\displaystyle x}$ is a quadratic function of ${\displaystyle z}$, the projection of the intersection onto the xz-plane is the section of an orthogonal parabola; it is only a section due to the fact that ${\displaystyle -r. The vertex of the parabola lies at point ${\displaystyle (-b,0,0)}$, where

${\displaystyle b={\frac {R^{2}-r^{2}-a^{2}}{2a}}.}$

### Intersection consists of two closed curves

If ${\displaystyle R>r+a}$, the condition ${\displaystyle x cuts the parabola into two segments. In this case, the intersection of sphere and cylinder consists of two closed curves, which are mirror images of each other. Their projection in the xy-plane are circles of radius ${\displaystyle r}$.

Each part of the intersection can be parametrized by an angle ${\displaystyle \phi }$:

${\displaystyle (x,y,z)=\left(r\cos \phi ,r\sin \phi ,\pm {\sqrt {2a(b+r\cos \phi )}}\right).}$

The curves contain the following extreme points:

${\displaystyle \left(-r,0,\pm {\sqrt {R^{2}-(r+a)^{2}}}\right);\quad \left(0,\pm r,\pm {\sqrt {R^{2}-(r-a)(r+a)}}\right);\quad \left(+r,0,\pm {\sqrt {R^{2}-(r-a)^{2}}}\right).}$

### Intersection is a single closed curve

If ${\displaystyle R, the intersection of sphere and cylinder consists of a single closed curve. It can be described by the same parameter equation as in the previous section, but the angle ${\displaystyle \phi }$ must be restricted to ${\displaystyle -\phi _{0}<\phi <+\phi _{0}}$, where ${\displaystyle \cos \phi _{0}=-b/r}$.

The curve contains the following extreme points:

${\displaystyle \left(-b,\pm {\sqrt {r^{2}-b^{2}}},0\right);\quad \left(0,\pm r,\pm {\sqrt {R^{2}-(r-a)(r+a)}}\right);\quad \left(+r,0,\pm {\sqrt {R^{2}-(r-a)^{2}}}\right).}$

### Limiting case

Viviani's curve as intersection of a sphere and a cylinder

In the case ${\displaystyle R=r+a}$, the cylinder and sphere are tangential to each other at point ${\displaystyle (r,0,0)}$. The intersection resembles a figure eight: it is a closed curve which intersects itself. The above parametrization becomes

${\displaystyle (x,y,z)=\left(r\cos \phi ,r\sin \phi ,2{\sqrt {ar}}\cos {\frac {\phi }{2}}\right),}$

where ${\displaystyle \phi }$ now goes through two full revolutions.

In the special case ${\displaystyle a=r,R=2r}$, the intersection is known as Viviani's curve. Its parameter representation is

${\displaystyle (x,y,z)=\left(r\cos \phi ,r\sin \phi ,R\cos {\frac {\phi }{2}}\right).}$