Circumference of elliptical rim in a tilted half-full cylindrical cup I thought I could find the circumference of this water ellipse using Pythagoras, but I get a slightly higher number when I use online ellipse circumference calculators. I have stared down into my cup for an hour trying to figure out why, but the cup did unfortunately not offer me any answers... hopefully someone here can.

By Pythagoras I mean unfolding the cylinder into a rectangle - as half of the ellipse travels from the rim to the bottom I thought the ellipse would turn into the half-rectangle diagonal, i.e. the hypotenuse, to be solved with $\pi$$r$  as the base and $length$/$height$ of the cylinder. But I get a slightly different answer using the ellipse's minor and major axis in online calculators. Should I not be getting the same answer?
Thank you
 A: For a cylinder of radius $r$ and height $h$, the circumference of the half-tilted elliptical rim is
$$2\int_0^1\sqrt{\frac{4r^2}{1-x^2}+ h^2} \ dx$$
On the other hand, the Pythagorean calculation yields
$2 \sqrt{\pi^2r^2+ h^2}$, which is always shorter. Note that it is the limiting value of the integral for either $r\ll h$ or $r\gg h$.
A: Starting from @Quanto's answer, let $h=2 k r$ and let us compare
$$L_1=4r \int_0^1\sqrt{\frac{1}{1-x^2}+ k^2} \, dx\qquad \text{and} \qquad 
L_2=2r \sqrt{4 k^2+\pi ^2} $$
We have
$$L_1=4r\sqrt{k^2+1}\, E\left(\frac{k^2}{k^2+1}\right)\implies
 \frac {L_1}{L_2}=\frac{2 \sqrt{k^2+1} }{\sqrt{4 k^2+\pi ^2}} \,E\left(\frac{k^2}{k^2+1}\right)$$ where $E(t)$ is the the complete elliptic integral of the second kind. As a series
$$E(t)=\frac \pi 2 \sum_{n=0}^\infty \frac{2^{-4 n} ((2 n)!)^2 }{(1-2 n) (n!)^4}\,t^n$$
Using
$$k=\sqrt{\frac{t}{1-t} } \quad \implies\quad  \frac {L_1}{L_2}=\frac { 2 E(t)}{\sqrt{ \pi ^2-\left(\pi ^2-4\right) t} }$$
Some numerical values
$$\left(
\begin{array}{cc}
k & \frac {L_1}{L_2} \\
 0.00 & 1.00000 \\
 0.25 & 1.00283 \\
 0.50 & 1.00991 \\
 0.75 & 1.01835 \\
 1.00 & 1.02578 \\
 1.25 & 1.03115 \\
 1.50 & 1.03440 \\
 1.75 & 1.03593 \\
 2.00 & 1.03621
\end{array}
\right)$$
