    def corner_half_length(a, b):
        """Return the length of the half of one ellipsis corner.

        Inspired by [Ramanujan, S., "Modular Equations and Approximations to
        pi" Quart. J. Pure. Appl. Math., vol. 45 (1913-1914), pp. 350-372],
        wonderfully explained by Dr Rob.

        https://mathforum.org/dr.math/faq/formulas/

        """
        x = (a - b) / (a + b)
        return pi / 8 * (a + b) * (
            1 + 3 * x ** 2 / (10 + sqrt(4 - 3 * x ** 2)))
Return the length of the half of one ellipsis corner.

Inspired by [Ramanujan, S., "Modular Equations and Approximations to
pi" Quart. J. Pure. Appl. Math., vol. 45 (1913-1914), pp. 350-372],
wonderfully explained by Dr Rob.

https://mathforum.org/dr.math/faq/formulas/
weasyprint/draw/border.py