bug-lilypond
[Top][All Lists]
Advanced

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

Re: Tweaking Hairpin shape


From: David Nalesnik
Subject: Re: Tweaking Hairpin shape
Date: Sat, 10 Feb 2018 12:02:37 -0600

Hi Stefano,

On Sat, Feb 10, 2018 at 11:14 AM, Stefano Troncaro
<address@hidden> wrote:
> Hi David, thank you for your suggestions, this is almost done!
>
> I decided to pass an alist to the function instead of changing the amount of
> arguments based on the procedure name, mainly because if I write more angle
> functions in the future I want to be able to do so without having to temper
> with the stencil definition. That is however a useful idea that I would have
> never thought about, and I may find it useful in the future.
>
> I have a few doubts if you don't mind.
>
> 1) At first I couldn't make the alist approach work because for some reason
> I can't define one in a let or let* block. Do you know why? I googled and I
> couldn't find an explanation.
>
> 2) Is there a way to define an alist different than a succession of acons? I
> thought I would be able to create it with a syntax like '((k1 . v1) (k2 .
> v2) ... etc) but in the end I had to settle for (acons k1 v1 (acons k2 v2
> ... (acons kn vn '()))).

Not sure what you could have been doing wrong, but there are two ways you could
define the alist

(list (cons 'grob grob) (cons 'width width) (cons 'starth starth)
(cons 'endh endh))

or through quasi-quoting:

 `((grob . ,grob) (width . ,width) (starth . ,starth) (endh . ,endh))


> 3) I made the following function to make it so that the upper line of the
> hairpin runs parallel with the staff lines. It does so by finding the angle
> that is formed between the "zero-point" of the hairpin (the point where it
> begins to open) and the ending point of the higher hairpin line, that is in
> (width, height). The function takes into account that the lines of hairpins
> that go through a system break have different starting and ending heights,
> this is called "adjusted height" here.

But the spanner is cloned for each broken segment, so you aren't
actually comparing
with the initial bit.  Each new segment is simply drawn with a stencil
reflecting its
position within the whole.

With all this in mind, the function
> finds the angle of the upper line of the hairpin, and returns the negative
> of that angle, which ideally would result in that angle being 0 degrees,
> making it so that the upper line is parallel to the staff. But the end
> result is slightly off (see image). I don't know if the math is wrong or if
> this problem arises from rounding differences. If it is the later I may need
> to formulate another approach entirely. Any insight on this?

I noticed this.  I'm not great with trig, so I'm not seeing right away
how to approach this
by rotating the hairpin.  But why rotate it in the first place?  You
simply want the top or
bottom line--you also need to consider if the hairpin is above the
staff--to be horizontal.  So
create a property 'follow-staff or something and, when set, draw a
straight line for one of the two lines
which are joined to create the hairpin, instead of two lines which
split the opening width.

>
> Thank you for all the help!!

You're very welcome!

David



reply via email to

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