[cairo] Howto draw quadratic curves with cairo?
Bill Spitzak
spitzak at gmail.com
Fri Oct 16 11:48:08 PDT 2009
All variables are vectors with 2 or more points.
To turn quad(p0, p1, p2) into cubic(q0, q1, q2, q3):
q0 = p0
q1 = (p0+2*p1)/3
q2 = (p2+2*p1)/3
q3 = p2
Ascii diagram, q1 and q2 are 2/3 the distance along the lines:
p0 p2
\ /
\ /
\ /
q1 q2
\ /
p1
Sebastien Pouliot wrote:
> Hello Clemens,
>
> We have such code inside Moonlight
> http://anonsvn.mono-project.com/viewvc/trunk/moon/src/moon-path.c?revision=127537&view=markup
>
> Sebastien
>
> On Fri, 2009-10-16 at 12:25 -0400, Clemens Eisserer wrote:
>> Hi,
>>
>> I would like to use cairo for drawing quadratic bezier curves, however
>> as as far as I saw cairo only supports cubic curves.
>> I guess its not hard, but could anybody help me out howto create cubic
>> curve parameters out of quadratic ones?
>>
>> Thank you in advance, Clemens
More information about the cairo
mailing list