lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some code for polygons


From: David Feuer
Subject: Some code for polygons
Date: Mon, 10 Apr 2006 12:48:06 -0400

I've written code to do rounded polygons /properly/ in both PostScript
and SVG.  The SVG was a bit tricky because SVG doesn't have
PostScript's arct.  I would greatly appreciate some help changing the
code in lookup.cc to match my new drawing procedures.  I'm still not
sure whether the polygon drawer should take a list of vertices or an
array of vertices.  A list makes more sense for the PostScript
backend, an array makes more sense for the SVG backend.  The attached
implementation takes an array.

The essential advantage of the new code over the old is that it
explicitly draws the outline of the rounded polygon rather than
fudging it by shrinking a polygon and stroking it with a certain line
thickness.  This provides several advantages over the current LilyPond
code:

1.  Full support for non-convex, and even self-intersecting, polygons.
 Currently, Lilypond can't round concave corners.
2.  Intuitive implementation.
3.  Much more flexibility.  In particular, corners can be rounded
differently depending on their geometry.  The current code and the
code I attach give strange results when corners are very sharp or
sides are very short.  I think it would probably be good to make the
rounding radius vary smoothly with the angle, using the exact
specified radius only for 90 degree corners.  I haven't experimented
with it yet, but I have a couple of ideas for how it might vary.

David Feuer

Attachment: polygon-ps.scm
Description: Text Data

Attachment: polygon.ps
Description: PostScript document

Attachment: polygon-svg.scm
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]