I'm searching for the mathematical justification, preferably in the form

of a journal article or white paper, for a routine I found as part of

Apple's QuickDraw GX cubic library. A version of the same routine can

also be found in the Balloon graphics system of Squeak <www.squeak.org>.

The problem at hand is approximating a cubic bezier segment with a

compound curve composed of quadratic bezier segments. According to the

comments on the routine,it calculates an upper bound for the number of

quadratic bezier segments needed to approximate the cubic within a

certain error.

Given the points of the cubic as a, b, c, and d (with a and d as the

endpoints of the curve, b and c as the intermediate control points, the

routine makes the following calculation (in pseudocode):

somevector = (3*b - a) - (3*c - d)

veclen = sqrt(someVector.x ^ 2 + someVector.y ^ 2)

numQuads = (veclen / 20.0) ^ (1.0/3.0) // or cube root of veclen / 20

numQuads = ceil(numquads)

if(numQuads <= 0) numQuads += 1;

return numQuads

After this, the code simply uses forward differencing to generate

quadratic segments at an interval of 1.0 / numquads.

The first mysterious quantity is the vector calculated in the first

line. I don't understand what value is being calculated (why are the

control vector's components multiplied by 3 before the vector back to

the endpoints is determined?)

Also according to the comments, the accuracy of the generated curves can

be increased by changing the mysterious 20 in the afformentioned

equation with a different value. (10 for half pixel accuracy, 5 for

quarter pixel accuracy etc...)

My question is does anyone know where this routine came from? It looks

to be doing some calculations based on a least-squares fit of the

original cubic, but on the whole I find the routine very mysterious and

black-magic like. Can you suggest where I might find a paper describing

the mathematics behind the technique used?

Scott Thompson