lilypond-user
[Top][All Lists]
Advanced

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

Re[2]: Slur with left and/or right arrow head


From: Trevor
Subject: Re[2]: Slur with left and/or right arrow head
Date: Fri, 19 Apr 2019 21:37:09 +0000
User-agent: eM_Client/7.2.34711.0


Aaron, Harm

Could I please comment on just one feature? The overrides to add or inhibit arrow-heads at the left and right ends of the Slur are:

  \override Slur.details.arrow-left = #LEFT
  \override Slur.details.arrow-right = #RIGHT
  \override Slur.details.arrow-left = ##f
  \override Slur.details.arrow-right = ##f

This slightly confused me, especially when I tried

  \override Slur.details.arrow-right = #LEFT

which draws a left-pointing arrow-head at the right end of the Slur. Something I don't think anyone would want.

Why not have the simpler and less confusing

  \override Slur.details.arrow-left = ##t
  \override Slur.details.arrow-right = ##t
  \override Slur.details.arrow-left = ##f
  \override Slur.details.arrow-right = ##f

?

Trevor

------ Original Message ------
From: "Thomas Morley" <address@hidden>
To: "Aaron Hill" <address@hidden>; "Lukas-Fabian Moser" <address@hidden>
Cc: "lilypond-user" <address@hidden>
Sent: 19/04/2019 22:03:31
Subject: Re: Slur with left and/or right arrow head

Am Di., 16. Apr. 2019 um 23:45 Uhr schrieb Aaron Hill
<address@hidden>:
 
On 2019-04-16 10:37 am, Thomas Morley wrote:
> Am Mo., 15. Apr. 2019 um 19:26 Uhr schrieb Lukas-Fabian Moser
> <address@hidden>:
>>
>> Folks,
>>
>> in
>> https://archiv.lilypondforum.de/index.php?topic=1744.msg9669#msg9669,
>> Harm invented a truly wonderful new feature allowing to add an arrow
>> head to the right end of a Slur (or, for that matter, a Tie,
>> PhrasingSlur etc.). I reproduce it here with only trivial changes
>> (mainly omitting parser/location).
>>
>> Now I also need slurs with arrows pointing to the left (and ideally,
>> also the option to have an arrow tip at both ends of the Slur). At
>> first
>> glance the asymmetry favoring the right hand side of a Slur seems to
>> be
>> hard-coded pretty deeply in Harm's code. Is there a cheap way to add a
>> choice of "left or right end" (if not even the "or/and" possibility)?
>>
>> Best
>> Lukas
>
> Hi Lukas,
>
> I started to implement the functionality, finally I more or less
> rewrote anything.
> As David K once said: rewriting all means at least knowing where the
> bugs are...
 
Harm,
 
There is an annoying optical issue where using the angle of the curve at
the end points does not work well for an arrow head that partially
overlaps the curve. Instead, one needs to consider the slope of the
curve a little inwards from the ends so that the arrow appears to be
aligned properly.
 
I took a stab at patching your code to address this. This involved some
additional computational work for various metrics of a Bezier curve.
See the attached files.
 
Among the things I changed is that the code that adds the arrows to the
ends of the curve no longer applies an offset. This offset was strictly
horizontal which did not work well for more heavily rotated arrows.
Instead, the offset is done within the code that computes and rotates
the arrow, so that the center of rotation is properly defined.
 
Hi Aaron,
 
meanwhile I think I understand more about Beziers, many thanks for
your and David's explanations.
Also, I looked entirely through your code and probably understood how
you do things.
 
As already said I stumbled across some procedures being called over
and over, also I asked myself why we need the entire length of the
Bezier, if we are interested only in a short part at start/end.
So I wrote a procedure (relying on `split-bezier´ from
bezier-tools.scm), where the Bezier is splitted, i.e. two sets of new
control-points are returned.
For those new control-points the direct line between first and last
point is calculated. If this is lower than a certain treshold, we have
control-points for a Bezier where we can calculate the angle,
otherwise it continues to recurse until the goal is reached. Relying
on start/end of the original Bezier it's first or last of the new
points, which now can serve for calculating the angle.
 
Function-calls are drastically reduced, performance time is reduced
and code simplified imho.
 
One thing I noticed are not so nice printed arrows for short Beziers
like Repeat/LaissezVibrerTie.
Likely due to the width of the arrowhead, _within_ this width the
Bezier is "too active", so to speak.
 
 
In general I've found your function to calculate a point on the Bezier
and to calculate an angle at a certain point of the Bezier _very_
helpful.
What do you think adding it to bezier-tools.scm?
 
Attached the newest code.
 
WYT?
 
Thanks,
Harm
 
@ Lukas
Up to now I didn't tackle the arrow-left/right LEFT/RIGHT thing, I
first wanted to fight my way through the code for Beziers.
Probably tomorrow, hopefuly ...

reply via email to

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