# Viviani's curve

In mathematics, Viviani's curve, also known as Viviani's window, is a figure eight shaped space curve named after the Italian mathematician Vincenzo Viviani. It is the intersection of a sphere with a cylinder that is tangent to the sphere and passes through two poles (a diameter) of the sphere (see diagram). Before Viviani this curve was studied by Simon de La Loubère and Gilles de Roberval.
The orthographic projection of Viviani's curve onto a plane perpendicular to the line through the crossing point and the sphere center is the lemniscate of Gerono, while the stereographic projection is a hyperbola or the lemniscate of Bernoulli, depending on which point on the same line is used to project.
In 1692 Viviani solved the following task: Cut out of a half sphere (radius $r$) two windows, such that the remaining surface (of the half sphere) can be squared, i.e. a square with the same area can be constructed using only compasses and ruler. His solution has an area of $4r^{2}$ (see below).

## Equations

In order to keep the proof for squaring simple,
    the sphere has the equation $\;x^{2}+y^{2}+z^{2}=r^{2}\;$
and
    the cylinder is upright with equation $\;x^{2}+y^{2}-rx=0\;$.
The cylinder has radius $r/2$ and is tangent to the sphere at point $(r,0,0)\ .$

## Properties of the curve
### Floor plan, elevation and side plan

Elimination of $x$ , $y$ , $z$ respectively yields:
The orthogonal projection of the intersection curve onto the
    $x$-$y$-plane is the circle with equation $\;\left(x-{\tfrac {r}{2}}\right)^{2}+y^{2}=\left({\tfrac {r}{2}}\right)^{2}\ .$
    $x$-$z$-plane the parabola with equation $\;x=-{\tfrac {1}{r}}z^{2}+r\;.$
    $y$-$z$-plane the algebraic curve with the equation $\;z^{4}+r^{2}(y^{2}-z^{2})=0\;.$

### Parametric representation

Representing the sphere by
    ${\begin{array}{cll}x&=&r\cdot \cos \theta \cdot \cos \varphi \\y&=&r\cdot \cos \theta \cdot \sin \varphi \\z&=&r\cdot \sin \theta \qquad \qquad -{\tfrac {\pi }{2}}\leq \theta \leq {\tfrac {\pi }{2}}\ ,\ -\pi \leq \varphi \leq \pi \;,\end{array}}$
and setting $\;\varphi =\theta ,\;$ yields the curve
    ${\begin{array}{cll}x&=&r\cdot \cos \theta \cdot \cos \theta \\y&=&r\cdot \cos \theta \cdot \sin \theta \\z&=&r\cdot \sin \theta \qquad \qquad -{\tfrac {\pi }{2}}\leq \theta \leq {\tfrac {\pi }{2}}\ .\end{array}}$
One easily checks that the spherical curve fulfills the equation of the cylinder. But the boundaries allow only the red part (see diagram) of Viviani's curve. The missing second half (green) has the property $\;\color {green}\varphi =-\theta \;.$
With help of this parametric representation it is easy to prove the statement: The area of the half sphere (containing Viviani's curve) minus the area of the two windows is $4r^{2}$. The area of the upper right part of Viviani's window (see diagram) can be calculated by an integration:
    $\iint _{S_{sphere}}r^{2}\cos \theta \,\mathrm {d} \theta \,\mathrm {d} \varphi =r^{2}\int _{0}^{\pi /2}\int _{0}^{\theta }\cos \theta \,\mathrm {d} \varphi \,\mathrm {d} \theta =r^{2}\left({\frac {\pi }{2}}-1\right)\ .$
Hence the total area of the spherical surface included by Viviani's curve is $2\pi r^{2}-4r^{2}$ and the area of the half sphere ($2\pi r^{2}$) minus the area of Viviani's window is $\;4r^{2}\;$, the area of a square with the sphere's diameter as the length of an edge.

### Rational Bézier representation

The quarter of Viviani's curve that lies in the all-positive quadrant of 3D space cannot be represented exactly by a regular Bézier curve of any degree.
However, it can be represented exactly by a 3D rational Bézier segment of degree 4, and there is an infinite family of rational Bézier control points generating that segment.
One possible solution is given by the following five control points:
    ${\boldsymbol {p0}}={\begin{bmatrix}0\\0\\1\\1\end{bmatrix}}{\boldsymbol {p1}}={\begin{bmatrix}0\\{\frac {1}{2{\sqrt {2}}}}\\{\frac {1}{\sqrt {2}}}\\{\frac {1}{\sqrt {2}}}\end{bmatrix}}{\boldsymbol {p2}}={\begin{bmatrix}{\frac {1}{3}}\\{\frac {1}{2}}\\{\frac {1}{2}}\\{\frac {2}{3}}\end{bmatrix}}{\boldsymbol {p3}}={\begin{bmatrix}{\frac {1}{\sqrt {2}}}\\{\frac {1}{2{\sqrt {2}}}}\\{\frac {1}{2{\sqrt {2}}}}\\{\frac {1}{\sqrt {2}}}\end{bmatrix}}{\boldsymbol {p4}}={\begin{bmatrix}1\\0\\0\\1\end{bmatrix}}$
The corresponding rational parametrization is:
    $\left({\begin{array}{c}{\frac {2\mu ^{2}\left(\mu ^{2}-2\left(2+{\sqrt {2}}\right)\mu +4{\sqrt {2}}+6\right)}{\left(2(\mu -1)\mu +{\sqrt {2}}+2\right)^{2}}}\\{\frac {2(\mu -1)\mu \left((\mu -1)\mu -3{\sqrt {2}}-4\right)}{\left(2(\mu -1)\mu +{\sqrt {2}}+2\right)^{2}}}\\-{\frac {(\mu -1)\left({\sqrt {2}}\mu +{\sqrt {2}}+2\right)}{2(\mu -1)\mu +{\sqrt {2}}+2}}\\\end{array}}\right)\;\mu \in \left[0,1\right]$

## Relation to other curves

* The 8-shaped elevation (see above) is a Lemniscate of Gerono.
* Viviani's curve is a special Clelia curve. For a Clelia curve the relation between the angles is $\;\varphi =c\;\theta \;.$
Subtracting 2× the cylinder equation from the sphere's equation and applying completing the square leads to the equation
    $(x-r)^{2}+y^{2}=z^{2}\;,$
which describes a right circular cone with its apex at $\;(r,0,0)\;$, the double point of Viviani's curve. Hence
* Viviani's curve can be considered not only as the intersection curve of a sphere and a cylinder but also as
    a) the intersection of a sphere and a cone and as
    b) the intersection of a cylinder and a cone.