[Top][All Lists]
[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
polygon-ps.scm
Description: Text Data
polygon.ps
Description: PostScript document
polygon-svg.scm
Description: Text Data
- Some code for polygons,
David Feuer <=
- Re: Some code for polygons, Jan Nieuwenhuizen, 2006/04/11
- Re: Some code for polygons, Jan Nieuwenhuizen, 2006/04/12
- Message not available
- Re: Some code for polygons, Jan Nieuwenhuizen, 2006/04/12
- Re: Some code for polygons, David Feuer, 2006/04/12
- Re: Some code for polygons, Jan Nieuwenhuizen, 2006/04/12
- Re: Some code for polygons, David Feuer, 2006/04/12
- Re: Some code for polygons, Juergen Reuter, 2006/04/12
- Re: Some code for polygons, Jan Nieuwenhuizen, 2006/04/12
- Re: Some code for polygons, David Feuer, 2006/04/12