[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slur with left and/or right arrow head
From: |
Thomas Morley |
Subject: |
Re: Slur with left and/or right arrow head |
Date: |
Fri, 19 Apr 2019 23:03:31 +0200 |
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 ...
arrow-slur-04.ly
Description: Text Data
- Re: Slur with left and/or right arrow head, (continued)
- Re: Slur with left and/or right arrow head, David Kastrup, 2019/04/17
- Re: Slur with left and/or right arrow head, Thomas Morley, 2019/04/17
- Re: Slur with left and/or right arrow head, David Kastrup, 2019/04/17
- Re: Slur with left and/or right arrow head, Thomas Morley, 2019/04/17
- Re: Slur with left and/or right arrow head, Aaron Hill, 2019/04/17
- Re: Slur with left and/or right arrow head, Carl Sorensen, 2019/04/18
- Re: Slur with left and/or right arrow head, Aaron Hill, 2019/04/17
- Re: Slur with left and/or right arrow head, Thomas Morley, 2019/04/19
- Re: Slur with left and/or right arrow head, Aaron Hill, 2019/04/19
- Re: Slur with left and/or right arrow head, Thomas Morley, 2019/04/19
- Re: Slur with left and/or right arrow head,
Thomas Morley <=
- Re[2]: Slur with left and/or right arrow head, Trevor, 2019/04/19
- Re: Re[2]: Slur with left and/or right arrow head, Thomas Morley, 2019/04/20
Re: Slur with left and/or right arrow head, Carl Sorensen, 2019/04/18