A simple formula for computing the length of a quadratic Bezier arc

We derive a simple formula to compute the length of a quadratic Bezier arc whose control points are \((a,b,c)\in(\mathbb R^2)^3\). Existing codes can be found here and there: The process is to convert the arc from the Bernstein basis \((a,b,c)\) to the standard polynomial basis \((A,B,C)\), then compute the derivative vector and calculate the integral. The result is expressed in terms of elements produced during the integration. Here, we go one step further and re-express the final formula in terms of \(A,B\) and \(F=A+B\). \(a,b\) and \(c\). The resulting formula is simpler and nicely symmetric.
--
Samuel Hornus, February 26, 2020.

The polynomial transform

We obtain \(P(t)=A t^2 + 2 B t + C\) where \(\left\{\begin{array}{ll} A &= a-b+c-b\\ B &= b-a\\ C &= a \end{array}\right..\)

Its derivative is \(P'(t)=2(At+B)\) whose length is \(|P'(t)|=2\sqrt{t^2|A|^2+2t(A\cdot B)+|B|^2}\).

The length of the quadratic arc is \(\displaystyle\ell=\int_{t=0}^{t=1}{|P'(t)|dt}\).

Computing the integral

Setting \(\left\{\begin{array}{ll} D &= \displaystyle\frac{(A\cdot B)}{|A|^2}\\ E &= \displaystyle\frac{|B|^2}{|A|^2} \end{array}\right.\), we get \(\displaystyle\ell=2|A|L\) with \(L=\int_{t=0}^{t=1}{\sqrt{t^2+2Dt+E}dt}\).

With the change of variable \(u=t+D\), we obtain \(\displaystyle L=\int_{u=D}^{u=1+D}{\sqrt{u^2+K}du}\), with \(K=E-D^2=\displaystyle\frac{|A|^2|B|^2-(A\cdot B)^2}{|A|^4}\).

We use the known result that \(\displaystyle \int{\sqrt{u^2+K}du}=\frac12\left[u\sqrt{u^2+K}+K\log{\left(u+\sqrt{u^2+K}\right)}\right]\).

Setting \(\displaystyle M(u)=u\sqrt{u^2+K}+K\log{\left(u+\sqrt{u^2+K}\right)}\), we get \(\displaystyle\ell=|A|\left(M(1+D)-M(D)\right)\).

Computing \(M(1+D)\)

If \(u=1+D\) we obtain \(\left\{\begin{array}{ll} \sqrt{u^2+K} &=\displaystyle\frac{|F|}{|A|}\\ u&=\displaystyle\frac{A\cdot F}{|A|^2} \end{array}\right.\), with \(F=A+B=c-b\).

So, \(M(1+D)=\displaystyle\frac{|F|(A\cdot F)}{|A|^3}+K\log{(|A||F|+A\cdot F)}-K\log{\left(|A|^2\right)}\).

Computing \(M(D)\)

If \(u=D=\displaystyle\frac{(A\cdot B)}{|A|^2}\) we obtain \(\sqrt{u^2+K} =\displaystyle\frac{|B|}{|A|}\).

So, \(M(D)=\displaystyle\frac{|B|(A\cdot B)}{|A|^3}+K\log{(|A||B|+A\cdot B)}-K\log{\left(|A|^2\right)}\).

The length now depends on 3 vectors, \(B=b-a\), \(F=c-b\) and \(A=F-B\):

\(\ell=\displaystyle \frac{|F|(A\cdot F)-|B|(A\cdot B)}{|A|^2} + \left(\frac{|A|^2|B|^2-(A\cdot B)^2}{|A|^3}\right)\times\left(\log{(|A||F|+A\cdot F)} - \log{(|A||B|+A\cdot B)}\right) \).

Notice that \(|A|^2|B|^2-(A\cdot B)^2 = |A|^2|B|^2\sin^2(\text{angle between $A$ and $B$})=\det^2(A,B)=\det^2(F,B)\).

Finally

\(\ell=\displaystyle \frac{|F|(A\cdot F)-|B|(A\cdot B)}{|A|^2} + \frac{\det^2(F,B)}{|A|^3}\times \left(\log{(|A||F|+A\cdot F)} - \log{(|A||B|+A\cdot B)}\right) \).