A quadratic bezier is expressed as follows, where A, B and C are our control points. We'll assume these are 2d vectors. t represents how far along the curve we are. g(t)=A(1−t)2+2B(1−t)t+Ct2,tϵ[0,1]
The arc length of any curve can be expressed as follows ∫δx2+δy2 We can think of g′(t) as follows δtδx=gx′(t),δtδy=gy′(t) Therefore ∫δx2+δy2=∫δt2δx2+δt2δy2δt=∫(gx′(t))2+(gy′(t))2δt=∫∣∣g′(t)∣∣δt
We need to find ∣∣g′(t)∣∣2g′(t)=2[(A−2B+C)t+(B−A)] Therefore ∣∣g′(t)∣∣2=4(∣∣A−2B+C∣∣2t2+(A−2B+C)⋅(B−A)t+∣∣B−A∣∣2)
This leavs us with a root of a quadratic polynomial in the following form. a=4∣∣A−2B+C∣∣2,b=4(A−2B+C)⋅(B−A),c=4∣∣B−A∣∣2∫∣∣g′(t)∣∣δt=∫at2+bt+cδt Dividing by "a" and converting to a depressed qradratic we get m=ab,n=ac,a∫t2+mt+nδt=a∫(2m+t)2+n−4m2δt We do some u sub giving us a quadratic in the following form k=n−4m2,u=2m+t,δu=δt,a∫u2+kδu For this to work we need to ensure that k is positibe or we're going to have a bad day. We'll assume A, B and C are scaler in this example for simplicity even though they're not. p=(A−2B+C),q=(B−C)a=p2,b=pq,c=q2k=ac−4a2b2=p2q2−4p4p2q2=p2q2−4p2q2p2q2>4p2q2 This proves k is positive. Going back to our integral, we then divide our integral by k. ak∫(ku)2+1δu More u sub v=ku,δv=kδu,ka∫v2+1δv Now we can subsitute v=tan(Θ)δv=sec2(Θ)δΘ,ka∫tan2(Θ)+1sec2(Θ)δΘ=ka∫sec2(Θ)sec2(Θ)δΘ=ka∫sec3(Θ)δΘ Now do integration by parts ∫sec3(Θ)δΘ=∫sec2(Θ)sec(Θ)δΘ=sec(Θ)tan(Θ)−∫tan2(Θ)sec(Θ)δΘ=sec(Θ)tan(Θ)−∫sec3(Θ)−sec(Θ)δΘ Now add ∫sec3(Θ)δΘ to both sides 2∫sec3(Θ)δΘ=sec(Θ)tan(Θ)+∫sec(Θ)δΘ Integrating we get ∫sec3(Θ)δΘ=21sec(Θ)tan(Θ)+21ln∣sec(Θ)+tan(Θ)∣ Now substituting in sec2=tan2+1 we get ∫sec3(Θ)δΘ=21tan(Θ)1+tan2(Θ)+21ln∣1+tan2(Θ)+tan(Θ)∣ Now substituting in v=tan(x) and adding our ka back we get the following. ka∫v2+1δv=2ka[v1+v2+ln(1+v2+v)] Finally we need to calculate v and k in terms of A, B, C and t. I might also multipley my integral by two then divide a b and c by four. P=(A−2B+C),Q=(B−C)a=P⋅P,b=P⋅Q,c=Q⋅Q,k=4a3c,z=2akb,v=z+ktarclength=ka(v1+v2+ln(1+v2+v)−z1+z2+ln(1+z2+z)) And we're done