lilypond-devel
[Top][All Lists]
Advanced

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

Re: Cluster spanner: problems with rendered output


From: V!ctor Adán
Subject: Re: Cluster spanner: problems with rendered output
Date: Tue, 8 Jul 2008 11:48:01 -0400

Hello All,

In trying to find a solution to this little problem (that ramp Clusters sometimes don't behave as I expect) I downloaded the source, complied it, and started looking around to see if I could find some answers.

I found that the function brew_cluster_piece( )  in cluster.cc calls round_filled_polygon in line 107. Specifically
107 out.add_stencil (Lookup::round_filled_polygon (points, blotdiameter));
 
The definition of round_filled_polygon opens with a detailed LIMITATIONS comment section, which clearly warn about the limitations of the function and its problems in certain cases:

/*
 * Create Stencil that represents a filled polygon with round edges.
 *
 * LIMITATIONS:
 *
 * (a) Only outer (convex) edges are rounded.
 *
 * (b) This algorithm works as expected only for polygons whose edges
 * do not intersect.  For example, the polygon ((0, 0), (q, 0), (0,
 * q), (q, q)) has an intersection at point (q/2, q/2) and therefore
 * will give a strange result.  Even non-adjacent edges that just
 * touch each other will in general not work as expected for non-null
 * blotdiameter.
 *
 * (c) Given a polygon ((x0, y0), (x1, y1), ... , (x (n-1), y (n-1))),
 * if there is a natural number k such that blotdiameter is greater
 * than the maximum of { | (x (k mod n), y (k mod n)) - (x ((k+1) mod n),
 * y ((k+1) mod n)) |, | (x (k mod n), y (k mod n)) - (x ((k+2) mod n),
 * y ((k+2) mod n)) |, | (x ((k+1) mod n), y ((k+1) mod n)) - (x ((k+2)
 * mod n), y ((k+2) mod n)) | }, then the outline of the rounded
 * polygon will exceed the outline of the core polygon.  In other
 * words: Do not draw rounded polygons that have a leg smaller or
 * thinner than blotdiameter (or set blotdiameter to a sufficiently
 * small value -- maybe even 0.0)!
 *
 * NOTE: Limitations (b) and (c) arise from the fact that round edges
 * are made by moulding sharp edges to round ones rather than adding
 * to a core filled polygon.  For details of these two different
 * approaches, see the thread upon the ledger lines patch that started
 * on March 25, 2002 on the devel mailing list.  The below version of
 * round_filled_polygon () sticks to the moulding model, which the
 * majority of the list participants finally voted for.  This,
 * however, results in the above limitations and a much increased
 * complexity of the algorithm, since it has to compute a shrinked
 * polygon -- which is not trivial define precisely and unambigously.
 * With the other approach, one simply could move a circle of size
 * blotdiameter along all edges of the polygon (which is what the
 * postscript routine in the backend effectively does, but on the
 * shrinked polygon). --jr
 */

So, as suggested, I set the blotdiameter  to 0.0 in the call to round_filled_polygon in cluster.cc, line 107. I recompiled, tested, and that fixed the output!
See attached png.

So my question is now, is it possible to make the blotdiameter a settable Context property, just like padding or X-offset are? Or does anyone have a better idea of how to be able to control this via Lilypond proper? 

Many thanks,

Victor

PS. my appologies for calling this a bug in the original post. Yes, I've learned my lesson.


On Sun, Jun 29, 2008 at 4:35 PM, V!ctor Adán <address@hidden> wrote:
Hello Lilyponders,

I'm using ramp-style Cluster spanners and I'm getting unexpected output.
When more than two identical chords follow each other, the upper boundary of the cluster collapses down one space and then goes back up.
In the example below (its corresponding image is attached), I have a sequence of 5 different chords, each repeated 4 times. Notice how the Cluster collapses in the two middle chords of each set. This is not what one would expect since all 4 chords are identical.  
Notice also how the collapsing of the cluster's vertical span does not happen when we use stairs-styled clusters.
So, is this a bug? I'd really like this not to happen...

Thoughts, suggestions?

Many thanks,

Victor

%%%%% START %%%%%
\version "2.11.45"
mycluster = \makeClusters{
   <g' g'>4 <g' g'> <g' g'> <g' g'>
   <f' a'> <f' a'> <f' a'> <f' a'>
   <e' b'> <e' b'> <e' b'> <e' b'>
   <d' c''> <d' c''> <d' c''> <d' c''>
   <c' d''> <c' d''> <c' d''> }
{
      \override ClusterSpanner #'style = #'ramp
      \mycluster
      r4
      \override ClusterSpanner #'style = #'leftsided-stairs
      \mycluster
}

%%%%% END %%%%%


Attachment: cluster_problem_fix.png
Description: PNG image


reply via email to

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