[cairo] Pen vertex estimation solutions

Carl Worth cworth at cworth.org
Tue Oct 12 07:57:36 PDT 2004


On Sat, 09 Oct 2004 23:16:47 -0700, Keith Packard wrote:
> Thanks to Walter Brisken, we have a solution to computing the number of 
> vertices needed for our polygonal pen.

Many thanks Walter! And thanks to you both for writing this all up so
thoroughly.

> Here's the comment that I've placed in the code.

I've gone through this to verify it and I saw just a few typos to correct.

>      MAX[a*cos(t) + b*sin(t)] = (a*a + b*b)/sqrt(a^2 + b^2)
>                                  = sqrt(a^2 + b^2)

Replace a*a and b*b with a^2 and b^2 for consistency.

>      r^2(t) = (a*cos(t) + b*sin(t))^2 + (c*cos(t) + d*sin(t))^2
>             = (a^2 + c^2)*cos(t) + (b^2 + d^2)*sin(t) 
>                + 2*(a*b + c*d)*cos(t)*sin(t) 

The second line should read:

              = (a^2 + c^2)*cos^2(t) + (b^2 + d^2)*sin^2(t) 

> Find the extremum by differentiation wrt t and setting that to zero
> 
> ∂(E²)/∂(t) = (1-cos(d))² (M² - m²) (-2 cos(t) sin(t))

Oops. A delta got ASCII-fied there.

Speaking of which. The utf-8 notation is lovely when rendered properly,
but it is less than useful in an ASCII-only environment. I'm not sure we
want to impose that burden on the code just yet. Or, if we do, then
someone needs to teach me how to get emacs to properly grok this. I had
to resort to the archives on the web to read the original message:

	http://cairographics.org/pipermail/cairo/2004-October/001972.html

Keith, do you have a patch ready for cairo already, or shall I put it
in?

-Carl




More information about the cairo mailing list