Re: What to do wanting a 4th order Bézier?

2016-10-12 Thread Urs Liska


Am 22.09.2016 um 01:38 schrieb Carl Sorensen:
>
> On 9/21/16 11:59 AM, "Urs Liska"  wrote:
>
>>  
>>  
>>
>>
>>
>>Am 21.09.2016 um 19:48 schrieb tisimst:
>>
>>
>>  
>>
>>  By the way, how do the curves appear
>>when the thickness is more pronounced (i.e., thicker). Does
>>it still come back down to a point at the end of each
>>segment? My guess is it does (simply because I haven't
>>tested it myself).
>>
>>  
>>
>>
>>
>>Yes, it does, see attached.
> I haven't looked at the code, but it should not be hard to get this to
> work.  Instead of a bezier, we use a bezier sandwich to make slurs.  It
> would be possible to use the bezier code for one side of the slur, and
> then offset the interior end control point for the sandwich.
>
> The dashed slur code shows how this is done for dashed slurs.
>
> If you haven't done it by the time I finish with the dots stuff, I will
> try to take a look at it.
>
> Thanks,
>
> Carl
>

Would it be possible (make sense) to draw a multi-segment curve directly
as a path? I mean, we already have all the necessary control points
available.

What is necessary is to draw a curved shape that has the same
characteristics as a LilyPond slur (in particular the configurable
thickness and the tips) but only on one side of the line.

Urs


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-10-09 Thread Thomas Morley
2016-10-09 13:23 GMT+02:00 Urs Liska :
>
>
> Am 09.10.2016 um 12:07 schrieb Thomas Morley:
>
> 2016-09-18 15:38 GMT+02:00 Simon Albrecht :
>
> On 18.09.2016 15:15, Kieren MacMillan wrote:
>
> And finally with a better user interface
>
> Under what circumstances would you NOT want the end of one curve to match
> precisely the beginning of the next one?
> If “none”, then I would say an even better user interface would not
> require typing that set of coordinates twice.
>
> I thought about that too – it also makes the data structure less complicated
> if it’s a list of seven pairs. I added the new version to the LSR
> , awaiting approval.
>
> Best, Simon
>
> Hi Simon,
>
> I'm not sure what to do with this snippet.
>
> I had the impression Urs started to implement it in the source. Is
> that true? Urs?
> Otoh, the LSR runs 2.18.0. With this version the lsr-snippet is the
> only available possibility to do slurs this way, warranting it's
> approval, I'd say.
>
> Opinions?
>
>
> I've started an implementation in https://github.com/openlilylib/snippets,
> but with the intention of proposing it for LilyPond proper. My approach
> doesn't require the redundant definition of control points (both doubling
> the start/end and ensuring the two opposing control points are in opposite
> directions), but actually I could even imagine integrating it into the
> \shape function, in a way that allows you to optionally add inflection
> points when shaping a slur.
>
> If it makes a difference (and I can imagine it does) my code will only run
> with latest LilyPond and would unreasonably complicated to backport (due to
> the really useful angle/vector ly:XXX functions that are available now).
>
> Urs
>
>
> Cheers,
>   Harm
>
>

Simon, Urs,

thanks for your replies.
I added a remark/link and approved it as
"Slur with two turning points"
http://lsr.di.unimi.it/LSR/Item?id=1045

Thanks,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-10-09 Thread Urs Liska


Am 09.10.2016 um 12:07 schrieb Thomas Morley:
> 2016-09-18 15:38 GMT+02:00 Simon Albrecht :
>> On 18.09.2016 15:15, Kieren MacMillan wrote:
 And finally with a better user interface
>>> Under what circumstances would you NOT want the end of one curve to match
>>> precisely the beginning of the next one?
>>> If “none”, then I would say an even better user interface would not
>>> require typing that set of coordinates twice.
>> I thought about that too – it also makes the data structure less complicated
>> if it’s a list of seven pairs. I added the new version to the LSR
>> , awaiting approval.
>>
>> Best, Simon
> Hi Simon,
>
> I'm not sure what to do with this snippet.
>
> I had the impression Urs started to implement it in the source. Is
> that true? Urs?
> Otoh, the LSR runs 2.18.0. With this version the lsr-snippet is the
> only available possibility to do slurs this way, warranting it's
> approval, I'd say.
>
> Opinions?

I've started an implementation in
https://github.com/openlilylib/snippets, but with the intention of
proposing it for LilyPond proper. My approach doesn't require the
redundant definition of control points (both doubling the start/end and
ensuring the two opposing control points are in opposite directions),
but actually I could even imagine integrating it into the \shape
function, in a way that allows you to optionally add inflection points
when shaping a slur.

If it makes a difference (and I can imagine it does) my code will only
run with latest LilyPond and would unreasonably complicated to backport
(due to the really useful angle/vector ly:XXX functions that are
available now).

Urs

>
> Cheers,
>   Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-10-09 Thread Simon Albrecht

On 09.10.2016 12:07, Thomas Morley wrote:

2016-09-18 15:38 GMT+02:00 Simon Albrecht :

On 18.09.2016 15:15, Kieren MacMillan wrote:

And finally with a better user interface

Under what circumstances would you NOT want the end of one curve to match
precisely the beginning of the next one?
If “none”, then I would say an even better user interface would not
require typing that set of coordinates twice.

I thought about that too – it also makes the data structure less complicated
if it’s a list of seven pairs. I added the new version to the LSR
, awaiting approval.

Best, Simon

Hi Simon,

I'm not sure what to do with this snippet.

I had the impression Urs started to implement it in the source. Is
that true? Urs?
Otoh, the LSR runs 2.18.0. With this version the lsr-snippet is the
only available possibility to do slurs this way, warranting it's
approval, I'd say.

Opinions?


In the end, it’s a UI design question, and a question on the 
relationship between LSR and openlilylib. Urs’ solution is much more 
sophisticated, of course, and its user interface is somewhat untypical 
in comparison to most LSR snippets.
I’d suggest to leave the LSR version as is (and approve it) and add a 
comment like


%% For a more refined solution to the problem, see .

Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-10-09 Thread Thomas Morley
2016-09-18 15:38 GMT+02:00 Simon Albrecht :
> On 18.09.2016 15:15, Kieren MacMillan wrote:
>>>
>>> And finally with a better user interface
>>
>> Under what circumstances would you NOT want the end of one curve to match
>> precisely the beginning of the next one?
>> If “none”, then I would say an even better user interface would not
>> require typing that set of coordinates twice.
>
>
> I thought about that too – it also makes the data structure less complicated
> if it’s a list of seven pairs. I added the new version to the LSR
> , awaiting approval.
>
> Best, Simon

Hi Simon,

I'm not sure what to do with this snippet.

I had the impression Urs started to implement it in the source. Is
that true? Urs?
Otoh, the LSR runs 2.18.0. With this version the lsr-snippet is the
only available possibility to do slurs this way, warranting it's
approval, I'd say.

Opinions?


Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-24 Thread Urs Liska


Am 24. September 2016 01:58:18 MESZ, schrieb Simon Albrecht 
:
>On 17.09.2016 20:27, Simon Albrecht wrote:
>> Hello folks,
>>
>> I’m attaching an excerpt from my current project, where I’d actually 
>> really need a 4th order Bézier slur – but that’s impossible with Lily
>
>> now. Unfortunately I also lack an idea what else to do in this 
>> situation – I’d like to avoid an extra staff…
>> Any ideas?
>
>Funny story: I now changed the arrangement so that I don’t even need a 
>compound slur –

LOL!

> but I’m really glad to have kicked off this
>development. 
>Thanks to those involved, and mainly thanks Urs!
>
>Best, Simon
>
>___
>lilypond-user mailing list
>lilypond-user@gnu.org
>https://lists.gnu.org/mailman/listinfo/lilypond-user

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-23 Thread Simon Albrecht

On 17.09.2016 20:27, Simon Albrecht wrote:

Hello folks,

I’m attaching an excerpt from my current project, where I’d actually 
really need a 4th order Bézier slur – but that’s impossible with Lily 
now. Unfortunately I also lack an idea what else to do in this 
situation – I’d like to avoid an extra staff…

Any ideas?


Funny story: I now changed the arrangement so that I don’t even need a 
compound slur – but I’m really glad to have kicked off this development. 
Thanks to those involved, and mainly thanks Urs!


Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Carl Sorensen


On 9/21/16 11:59 AM, "Urs Liska"  wrote:

>
>  
>  
>
>
>
>Am 21.09.2016 um 19:48 schrieb tisimst:
>
>
>  
>
>  By the way, how do the curves appear
>when the thickness is more pronounced (i.e., thicker). Does
>it still come back down to a point at the end of each
>segment? My guess is it does (simply because I haven't
>tested it myself).
>
>  
>
>
>
>Yes, it does, see attached.

I haven't looked at the code, but it should not be hard to get this to
work.  Instead of a bezier, we use a bezier sandwich to make slurs.  It
would be possible to use the bezier code for one side of the slur, and
then offset the interior end control point for the sandwich.

The dashed slur code shows how this is done for dashed slurs.

If you haven't done it by the time I finish with the dots stuff, I will
try to take a look at it.

Thanks,

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


OT: What to do wanting a 4th order Bézier?

2016-09-21 Thread Karlin High
On 9/21/2016 11:01 AM, Urs Liska wrote:
>
> I wouldn't claim production readiness yet, but I've gone a long way 
> with multi-segmented slurs :-)
>
> As you can see from the attached PDF files (if they don't block the 
> message from being delivered ...) we can now print slurs with an 
> arbitrary number of connected segments! The slur in the first system 
> is along the lines of the orginal print, and I've added a "fancy" 
> example with the red slur in the lower system.
>

I can't help but think of the Windows 7 "Ribbons" screensaver every time 
I look at these PDFs. Maybe this music is the soundtrack for it...
--
Karlin High
Missouri, USA

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Simon Albrecht

On 21.09.2016 19:48, tisimst wrote:

A next thing would be to show how this can be used to make flat slurs ;-)


If you try
%%
\version "2.19.47"
{
  1-\tweak control-points #'((0 . -5)(1 . -5)(5 . -5)(6 . -5)) ( 1)
}
%%
you see that the slur stencil procedure can produce a flat line (well, 
kind of, with the rounded sandwiching applied), so it’s possible to use 
this compoundSlur code with flat segments. I don’t know what you mean – 
do you mean ‘Novello-style’ moveable-type-like slurs with a rounded 
beginning, a long flat middle segment, and a rounded ending?


By the way, how do the curves appear when the thickness is more 
pronounced (i.e., thicker). Does it still come back down to a point at 
the end of each segment? My guess is it does (simply because I haven't 
tested it myself).


It sure does, and I thought that this is not a problem or in the 
contrary preferable because an engraver might have done the same, as in 
writing with a quill, so the curve naturally has these ‘bottlenecks’.


Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Urs Liska


Am 21.09.2016 um 19:46 schrieb Carl Sorensen:
>
> On 9/21/16 11:34 AM, "Urs Liska"  wrote:
>
>> By contrast
>>
>> inflection =
>> #'((point-X-ratio . 0.4)
>>   (point-Y . 12))
>
> I like this, but I would probably change it to
>
> inflection = 
> #'((X-ratio . 0.4) (Y-offset . 12))
>
> I think that the "point" part of the name is superfluous.

Great suggestion, I'll do it that way.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Urs Liska


Am 21.09.2016 um 19:48 schrieb tisimst:
> By the way, how do the curves appear when the thickness is more
> pronounced (i.e., thicker). Does it still come back down to a point at
> the end of each segment? My guess is it does (simply because I haven't
> tested it myself).

Yes, it does, see attached.

> That would be nice to be able to be able to specify whether it should
> taper back down or not. Feature request!

Well, that would be a "general" feature request which I can't do
anything about. I'm using LilyPond's code to drawing splines, concretely
(ly:slur::print grob).

Urs
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread tisimst
On Wed, Sep 21, 2016 at 11:36 AM, Urs Liska [via Lilypond] <
ml-node+s1069038n194817...@n5.nabble.com> wrote:

> I'm not clear if we are all talking about the same things. Maybe write it
> down explicitly:
>
> inflection =
> #'((point . (.4 . 12)))
>
> would now mean: "40 % through the horizontal space between the end points
> and 12 staff spaces above the vertical center between the points. This is
> completely easy to write down but surely confusing to learn, even if
> documented properly.
>
> By contrast
>
> inflection =
> #'((point-X-ratio . 0.4)
>(point-Y . 12))
>
> seems clearer but more verbose to write out.
>

I'm a fan of the verbosity, especially with such complex objects as this
where you may (easily!) have 10+ different numbers adjusting the overall
shape. It also self-documents what the values represent.

--
Abraham Lee

P.S. This is absolutely awesome, Urs! Well done. A next thing would be to
show how this can be used to make flat slurs ;-) By the way, how do the
curves appear when the thickness is more pronounced (i.e., thicker). Does
it still come back down to a point at the end of each segment? My guess is
it does (simply because I haven't tested it myself). That would be nice to
be able to be able to specify whether it should taper back down or not.
Feature request!




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/What-to-do-wanting-a-4th-order-Bezier-tp194666p194820.html
Sent from the User mailing list archive at Nabble.com.___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Carl Sorensen


On 9/21/16 11:34 AM, "Urs Liska"  wrote:

>
>By contrast
>
>inflection =
>#'((point-X-ratio . 0.4)
>   (point-Y . 12))


I like this, but I would probably change it to

inflection = 
#'((X-ratio . 0.4) (Y-offset . 12))

I think that the "point" part of the name is superfluous.



>seems clearer but more verbose to write out.

IMO, clarity should outweigh brevity in cases like this.

Thanks,

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Urs Liska


Am 21.09.2016 um 19:29 schrieb Simon Albrecht:
>> suggestion) but apply it to the vertical center between the two
>> endpoints? That way the whole slur should somewhat shift together with
>> changed Y of an end point.
>>
>> Would it be acceptable to have a pair? as an argument when the two
>> elements*do*  refer to X and Y but with completely different behaviour?
>> Or should that then be separated to two individual properties?
>
> That sounds like way over the top. The user interface should be
> reasonably easy to understand, so I’d prefer a simple staff-space
> offset for Y. It seems like a good idea to do it relative to the
> vertical center between the two endpoints, then 0 as a default is
> sensible.

I'm not clear if we are all talking about the same things. Maybe write
it down explicitly:

inflection =
#'((point . (.4 . 12)))

would now mean: "40 % through the horizontal space between the end
points and 12 staff spaces above the vertical center between the points.
This is completely easy to write down but surely confusing to learn,
even if documented properly.

By contrast

inflection =
#'((point-X-ratio . 0.4)
   (point-Y . 12))

seems clearer but more verbose to write out.

Urs

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Simon Albrecht

On 21.09.2016 19:22, Urs Liska wrote:

Am 21.09.2016 um 19:18 schrieb Carl Sorensen:

On 9/21/16 10:22 AM, "Urs Liska"  wrote:

 The other thing I came across is the specification of the
inflection*point*. Basically the idea of specifying independent
X and Y ratios between the slur's endpoints seems practical, as
it is pretty predictable. But I realized that this only works
well when the endpoints are sufficiently different on the
Y-scale. If the slur is horizontal then*any*  inflection will
necessarily be on that same horizontal line! So I need a
suggestion what could be a suitable, predictable*and*
un-limited approach to specifying this.

I think that you could use the X fraction as the X coordinate of the
inflection point.  And you could use a Y offset (in staff spaces from the
starting point) as the Y coordinate of the inflection point.  It seems
that should be relatively easy to implement.

Implementing that is easy, of course. What I'm thinking about mostly is
the predictability of the results when anything changes, for example the
Y coordinate of either point.

What would you think of using a staff-space offset for Y (as per your
suggestion) but apply it to the vertical center between the two
endpoints? That way the whole slur should somewhat shift together with
changed Y of an end point.

Would it be acceptable to have a pair? as an argument when the two
elements*do*  refer to X and Y but with completely different behaviour?
Or should that then be separated to two individual properties?


That sounds like way over the top. The user interface should be 
reasonably easy to understand, so I’d prefer a simple staff-space offset 
for Y. It seems like a good idea to do it relative to the vertical 
center between the two endpoints, then 0 as a default is sensible.


Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Urs Liska


Am 21.09.2016 um 19:18 schrieb Carl Sorensen:
>
> On 9/21/16 10:22 AM, "Urs Liska"  wrote:
>
>>  The other thing I came across is the specification of the
>>inflection *point*. Basically the idea of specifying independent
>>X and Y ratios between the slur's endpoints seems practical, as
>>it is pretty predictable. But I realized that this only works
>>well when the endpoints are sufficiently different on the
>>Y-scale. If the slur is horizontal then *any* inflection will
>>necessarily be on that same horizontal line! So I need a
>>suggestion what could be a suitable, predictable *and*
>>un-limited approach to specifying this.
> I think that you could use the X fraction as the X coordinate of the
> inflection point.  And you could use a Y offset (in staff spaces from the
> starting point) as the Y coordinate of the inflection point.  It seems
> that should be relatively easy to implement.

Implementing that is easy, of course. What I'm thinking about mostly is
the predictability of the results when anything changes, for example the
Y coordinate of either point.

What would you think of using a staff-space offset for Y (as per your
suggestion) but apply it to the vertical center between the two
endpoints? That way the whole slur should somewhat shift together with
changed Y of an end point.

Would it be acceptable to have a pair? as an argument when the two
elements *do* refer to X and Y but with completely different behaviour?
Or should that then be separated to two individual properties?

Urs

>
> Thanks,
>
> Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Carl Sorensen


On 9/21/16 10:22 AM, "Urs Liska"  wrote:

>  The other thing I came across is the specification of the
>inflection *point*. Basically the idea of specifying independent
>X and Y ratios between the slur's endpoints seems practical, as
>it is pretty predictable. But I realized that this only works
>well when the endpoints are sufficiently different on the
>Y-scale. If the slur is horizontal then *any* inflection will
>necessarily be on that same horizontal line! So I need a
>suggestion what could be a suitable, predictable *and*
>un-limited approach to specifying this.

I think that you could use the X fraction as the X coordinate of the
inflection point.  And you could use a Y offset (in staff spaces from the
starting point) as the Y coordinate of the inflection point.  It seems
that should be relatively easy to implement.

Thanks,

Carl
>


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Simon Albrecht
 is printing an optional 
grid which will ease finding the right inflection points, and maybe a 
raster along the handles (going beyond their current length. This 
would make it much easier to find the right values for these.


Have fun

Urs

Am 20.09.2016 um 13:53 schrieb Trevor Daniels:

Impressive work, Urs!  Kudos!
Trevor

- Original Message -
*From:* Urs Liska <mailto:u...@openlilylib.org>
*To:* lilypond-user@gnu.org <mailto:lilypond-user@gnu.org>
*Sent:* Monday, September 19, 2016 11:40 PM
    *Subject:* Re: What to do wanting a 4th order Bézier?



Am 19.09.2016 um 22:49 schrieb Urs Liska:

Am 19.09.2016 um 20:50 schrieb David Kastrup:

Urs Liska<u...@openlilylib.org>  writes:

[...]

You are working with slopes here.  Don't.  They don't support vertical
lines.


Yes, that's what I realized ...


Please take a look at the recently added functions

ly:length ly:angle ly:directed

They will usually make it easy to do the operations you want.  In
particular ly:directed can also use a vector as a direction without ever
calculating its angle.

Thanks! From looking at the docs it seems they'll do exactly what I want
(and had partially implemented in Scheme). Can't wait to return to my
LilyPond computer :-)



I think I now have it in a state where we can work from. The
angle of the inflection is now given as an angle relative to the
line connecting the end points of the whole slur. While an angle
relative to the horizontal line would be somewhat more
straightforward I think this approach is more robust against
changes (for example when the slur is cross-staff and the
staff-staff distance changes).

TODO:

  * support more than two segments
(shouldn't be *that* difficult, just tedious and slightly
complex)
  * support broken slurs
(each sibling should be togglable between multi-segment or
not, and it should be \shape-able)
  * support Slur, PhrasingSlur and Tie (like \shape)
  * specify shapes as polar coordinates (or all options that
\shapeII has)

The code is now at

https://github.com/openlilylib/snippets/tree/compound-slur/notation-snippets/shaping-bezier-curves

Best
Urs


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user







___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-21 Thread Urs Liska
scale. If the slur is
> horizontal then *any* inflection will necessarily be on that same
> horizontal line! So I need a suggestion what could be a suitable,
> predictable *and* un-limited approach to specifying this.
>
> Another minor wish I would like to implement is printing an optional
> grid which will ease finding the right inflection points, and maybe a
> raster along the handles (going beyond their current length. This
> would make it much easier to find the right values for these.
>
> Have fun
>
> Urs
>
> Am 20.09.2016 um 13:53 schrieb Trevor Daniels:
>> Impressive work, Urs!  Kudos!
>>  
>> Trevor
>>  
>>
>> - Original Message -
>> *From:* Urs Liska <mailto:u...@openlilylib.org>
>> *To:* lilypond-user@gnu.org <mailto:lilypond-user@gnu.org>
>> *Sent:* Monday, September 19, 2016 11:40 PM
>> *Subject:* Re: What to do wanting a 4th order Bézier?
>>
>>
>>
>> Am 19.09.2016 um 22:49 schrieb Urs Liska:
>>> Am 19.09.2016 um 20:50 schrieb David Kastrup:
>>>> Urs Liska <u...@openlilylib.org> writes:
>>>>
>>>> [...]
>>>>
>>>> You are working with slopes here.  Don't.  They don't support vertical
>>>> lines.
>>>>
>>> Yes, that's what I realized ...
>>>
>>>> Please take a look at the recently added functions
>>>>
>>>>ly:length ly:angle ly:directed
>>>>
>>>> They will usually make it easy to do the operations you want.  In
>>>> particular ly:directed can also use a vector as a direction without 
>>>> ever
>>>> calculating its angle.
>>> Thanks! From looking at the docs it seems they'll do exactly what I want
>>> (and had partially implemented in Scheme). Can't wait to return to my
>>> LilyPond computer :-)
>>>
>>
>> I think I now have it in a state where we can work from. The
>> angle of the inflection is now given as an angle relative to the
>> line connecting the end points of the whole slur. While an angle
>> relative to the horizontal line would be somewhat more
>> straightforward I think this approach is more robust against
>> changes (for example when the slur is cross-staff and the
>> staff-staff distance changes).
>>
>> TODO:
>>
>>   * support more than two segments
>> (shouldn't be *that* difficult, just tedious and slightly
>> complex)
>>   * support broken slurs
>> (each sibling should be togglable between multi-segment or
>> not, and it should be \shape-able)
>>   * support Slur, PhrasingSlur and Tie (like \shape)
>>   * specify shapes as polar coordinates (or all options that
>> \shapeII has)
>>
>> The code is now at
>> 
>> https://github.com/openlilylib/snippets/tree/compound-slur/notation-snippets/shaping-bezier-curves
>>
>> Best
>> Urs
>>
>> 
>> ___
>> lilypond-user mailing list
>> lilypond-user@gnu.org
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>>
>

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-20 Thread Urs Liska


Am 20.09.2016 um 13:53 schrieb Trevor Daniels:
> Impressive work, Urs!  Kudos!
>  

Thanks :-)

But I'm not finished yet. I assume I'm much more than halfway through to
supporting an arbitrary number of segments with a very manageable interface.
I'll presumably leave supporting broken slurs to a later attempt or
someone else, though.

Urs

> Trevor
>  
>
> - Original Message -
> *From:* Urs Liska <mailto:u...@openlilylib.org>
> *To:* lilypond-user@gnu.org <mailto:lilypond-user@gnu.org>
> *Sent:* Monday, September 19, 2016 11:40 PM
>     *Subject:* Re: What to do wanting a 4th order Bézier?
>
>
>
> Am 19.09.2016 um 22:49 schrieb Urs Liska:
>> Am 19.09.2016 um 20:50 schrieb David Kastrup:
>>> Urs Liska <u...@openlilylib.org> writes:
>>>
>>> [...]
>>>
>>> You are working with slopes here.  Don't.  They don't support vertical
>>> lines.
>>>
>> Yes, that's what I realized ...
>>
>>> Please take a look at the recently added functions
>>>
>>>ly:length ly:angle ly:directed
>>>
>>> They will usually make it easy to do the operations you want.  In
>>> particular ly:directed can also use a vector as a direction without ever
>>> calculating its angle.
>> Thanks! From looking at the docs it seems they'll do exactly what I want
>> (and had partially implemented in Scheme). Can't wait to return to my
>> LilyPond computer :-)
>>
>
> I think I now have it in a state where we can work from. The angle
> of the inflection is now given as an angle relative to the line
> connecting the end points of the whole slur. While an angle
> relative to the horizontal line would be somewhat more
> straightforward I think this approach is more robust against
> changes (for example when the slur is cross-staff and the
> staff-staff distance changes).
>
> TODO:
>
>   * support more than two segments
> (shouldn't be *that* difficult, just tedious and slightly
> complex)
>   * support broken slurs
> (each sibling should be togglable between multi-segment or
> not, and it should be \shape-able)
>   * support Slur, PhrasingSlur and Tie (like \shape)
>   * specify shapes as polar coordinates (or all options that
> \shapeII has)
>
> The code is now at
> 
> https://github.com/openlilylib/snippets/tree/compound-slur/notation-snippets/shaping-bezier-curves
>
> Best
> Urs
>
> 
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-20 Thread Trevor Daniels
Impressive work, Urs!  Kudos!

Trevor

  - Original Message - 
  From: Urs Liska 
  To: lilypond-user@gnu.org 
  Sent: Monday, September 19, 2016 11:40 PM
  Subject: Re: What to do wanting a 4th order Bézier?







  Am 19.09.2016 um 22:49 schrieb Urs Liska:

Am 19.09.2016 um 20:50 schrieb David Kastrup:
Urs Liska <u...@openlilylib.org> writes:

[...]

You are working with slopes here.  Don't.  They don't support vertical
lines.

Yes, that's what I realized ...

Please take a look at the recently added functions

   ly:length ly:angle ly:directed

They will usually make it easy to do the operations you want.  In
particular ly:directed can also use a vector as a direction without ever
calculating its angle.
Thanks! From looking at the docs it seems they'll do exactly what I want
(and had partially implemented in Scheme). Can't wait to return to my
LilyPond computer :-)


  I think I now have it in a state where we can work from. The angle of the 
inflection is now given as an angle relative to the line connecting the end 
points of the whole slur. While an angle relative to the horizontal line would 
be somewhat more straightforward I think this approach is more robust against 
changes (for example when the slur is cross-staff and the staff-staff distance 
changes).

  TODO:

a.. support more than two segments
(shouldn't be *that* difficult, just tedious and slightly complex) 
b.. support broken slurs
(each sibling should be togglable between multi-segment or not, and it 
should be \shape-able) 
c.. support Slur, PhrasingSlur and Tie (like \shape) 
d.. specify shapes as polar coordinates (or all options that \shapeII has) 
  The code is now at 
https://github.com/openlilylib/snippets/tree/compound-slur/notation-snippets/shaping-bezier-curves

  Best
  Urs




--


  ___
  lilypond-user mailing list
  lilypond-user@gnu.org
  https://lists.gnu.org/mailman/listinfo/lilypond-user
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-20 Thread Simon Albrecht

On 20.09.2016 00:40, Urs Liska wrote:

support Slur, PhrasingSlur and Tie (like \shape)


Don’t you agree that it shouldn’t be done for ties? Having such a 
complex shape for a tie seems like a really bad idea.


Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Urs Liska


Am 19.09.2016 um 22:49 schrieb Urs Liska:
> Am 19.09.2016 um 20:50 schrieb David Kastrup:
>> Urs Liska  writes:
>>
>> [...]
>>
>> You are working with slopes here.  Don't.  They don't support vertical
>> lines.
>>
> Yes, that's what I realized ...
>
>> Please take a look at the recently added functions
>>
>>ly:length ly:angle ly:directed
>>
>> They will usually make it easy to do the operations you want.  In
>> particular ly:directed can also use a vector as a direction without ever
>> calculating its angle.
> Thanks! From looking at the docs it seems they'll do exactly what I want
> (and had partially implemented in Scheme). Can't wait to return to my
> LilyPond computer :-)
>

I think I now have it in a state where we can work from. The angle of
the inflection is now given as an angle relative to the line connecting
the end points of the whole slur. While an angle relative to the
horizontal line would be somewhat more straightforward I think this
approach is more robust against changes (for example when the slur is
cross-staff and the staff-staff distance changes).

TODO:

  * support more than two segments
(shouldn't be *that* difficult, just tedious and slightly complex)
  * support broken slurs
(each sibling should be togglable between multi-segment or not, and
it should be \shape-able)
  * support Slur, PhrasingSlur and Tie (like \shape)
  * specify shapes as polar coordinates (or all options that \shapeII has)

The code is now at
https://github.com/openlilylib/snippets/tree/compound-slur/notation-snippets/shaping-bezier-curves

Best
Urs



compound-slur-example-sorabij.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Urs Liska
Am 19.09.2016 um 20:50 schrieb David Kastrup:
> Urs Liska  writes:
> 
> [...]
> 
> You are working with slopes here.  Don't.  They don't support vertical
> lines.
> 

Yes, that's what I realized ...

> Please take a look at the recently added functions
> 
>ly:length ly:angle ly:directed
> 
> They will usually make it easy to do the operations you want.  In
> particular ly:directed can also use a vector as a direction without ever
> calculating its angle.

Thanks! From looking at the docs it seems they'll do exactly what I want
(and had partially implemented in Scheme). Can't wait to return to my
LilyPond computer :-)

-- 
Urs Liska
www.openlilylib.org

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread David Kastrup
Urs Liska  writes:

[...]

You are working with slopes here.  Don't.  They don't support vertical
lines.

Please take a look at the recently added functions

   ly:length ly:angle ly:directed

They will usually make it easy to do the operations you want.  In
particular ly:directed can also use a vector as a direction without ever
calculating its angle.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Hans Åberg

> On 19 Sep 2016, at 20:25, David Kastrup  wrote:
> 
> Hans Åberg  writes:

>> Perhaps it looks better with the second derivatives lined up as well.
> 
> That precludes a straight line (second derivative 0) running into a
> circle arc (second derivative 1/(2pi r) or similar, too lazy to think
> about it right now).

It might be used to smooth ordinary 3rd degree polynomials. But if useful, it 
probably has already been done.



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread David Kastrup
Hans Åberg  writes:

>> On 19 Sep 2016, at 10:41, David Kastrup  wrote:
>
>> It would be my guess that the hands-on manipulative features of control
>> points have made cubic Beziers the go-to curve approximation and design
>> tool.
>
> Perhaps it looks better with the second derivatives lined up as well.

That precludes a straight line (second derivative 0) running into a
circle arc (second derivative 1/(2pi r) or similar, too lazy to think
about it right now).

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Hans Åberg

> On 19 Sep 2016, at 10:41, David Kastrup  wrote:

> It would be my guess that the hands-on manipulative features of control
> points have made cubic Beziers the go-to curve approximation and design
> tool.

Perhaps it looks better with the second derivatives lined up as well.



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Urs Liska


Am 19.09.2016 um 18:41 schrieb Urs Liska:
>
> Am 18.09.2016 um 22:16 schrieb Thomas Morley:
>> 2016-09-18 20:26 GMT+02:00 Urs Liska :
>>> Am 18.09.2016 um 18:28 schrieb Simon Albrecht:
 May I incorporate that into the LSR version?


>>> I suggest not to do anything right now. I assume that once I'll come up
>>> with the next iteration there will be more things to be discussed. I
>>> suggest to bring that to an end before deciding what to do with it.
>>> Maybe it would be good to include to LilyPond itself instead of the LSR.
>>>
>>> Urs
>> Hi all,
>>
>> I have my doubts we will ever find a possibility to do it reasonable 
>> automatic.
>> What to do at linebreaks or if more than two splines are needed?
>>
>> You probably already know the most extreme case, from Sorabji's Opus
>> Clavicembalisticum (1930):
>> http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation_files/Sorabji_Slur+Ctxt.png
>>
>> The paper where the image is taken from lists some more extreme notations:
>> http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation.html
>>
>> Cheers,
>>   Harm
> OK, I have prepared a proof-of-concept score (see attached) where we'll
> be able to really test the multiple-segment slurs ;-)
>
> As it is I'm once more astonished about how perfectly readable this
> score is by default (the only manual "tweaks" are some forced \voiceXXX
> in the sixtuplet voice).
>
> I'll upload that to the openLilyLib directory where I'll integrate the
> code, then start with one two-segment slur and take it as an incentive
> to support multi-segment slurs and later even broken slurs.
>
> Urs
>
>
First substantial limitation of my approach: The "slope" of the
inflection can't go backwards but can only approximate a vertical line.
What would be a better calculation for the inflection's angle?


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread David Kastrup
Hans Åberg  writes:

>> On 18 Sep 2016, at 14:41, Simon Albrecht  wrote:
>> 
>> On 18.09.2016 13:54, Andrew Bernard wrote:
>
>>> What is it exactly that you are expecting a quartic to give you?
>> 
>> Oh, I think you’re quite overestimating the amount of in-depth
>> mathematical background I had – I just thought: ‘A 3rd order Bézier
>> curve can have one turning point, but I need two turning points, so
>> I’d need a 4th order Bézier’. Which I now see is wrong, after some
>> experimenting with the interactive fields in that article you
>> linked: it requires a 5th order Bézier for that, and then it already
>> gets quite unhandy.
>
> Curves of higher polynomial order did not catch on, because they are
> not stable: small changes in the input variables can sometimes cause
> dramatic effects in the output curve.

Well, it depends on the input variables.  Bézier polynomials are, after
everything is said and done, polynomials of an independent parameter.
Expressing them in terms of control points makes them more tangible and
makes for a numerically robust evaluation scheme.  That also holds for
higher order Bézier polynomials: moving the control points does not have
"dramatic" effects in the output curve with respect to the x and y
coordinates as a function of the moving parameter t.  Still the
probability of cusps as a result of independent curvature changes in the
separate coordinates increases.

It would be my guess that the hands-on manipulative features of control
points have made cubic Beziers the go-to curve approximation and design
tool.  Even though you need only quadratic NURBS to represent conic
sections and their higher-dimensional equivalents perfectly, you don't
have a similarly straightforward handle on them like control points
provide.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Urs Liska


Am 18.09.2016 um 22:16 schrieb Thomas Morley:
> 2016-09-18 20:26 GMT+02:00 Urs Liska :
>> Am 18.09.2016 um 18:28 schrieb Simon Albrecht:
>>> May I incorporate that into the LSR version?
>>>
>>>
>> I suggest not to do anything right now. I assume that once I'll come up
>> with the next iteration there will be more things to be discussed. I
>> suggest to bring that to an end before deciding what to do with it.
>> Maybe it would be good to include to LilyPond itself instead of the LSR.
>>
>> Urs
> Hi all,
>
> I have my doubts we will ever find a possibility to do it reasonable 
> automatic.
> What to do at linebreaks or if more than two splines are needed?
>
> You probably already know the most extreme case, from Sorabji's Opus
> Clavicembalisticum (1930):
> http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation_files/Sorabji_Slur+Ctxt.png
>
> The paper where the image is taken from lists some more extreme notations:
> http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation.html
>
> Cheers,
>   Harm

OK, I have prepared a proof-of-concept score (see attached) where we'll
be able to really test the multiple-segment slurs ;-)

As it is I'm once more astonished about how perfectly readable this
score is by default (the only manual "tweaks" are some forced \voiceXXX
in the sixtuplet voice).

I'll upload that to the openLilyLib directory where I'll integrate the
code, then start with one two-segment slur and take it as an incentive
to support multi-segment slurs and later even broken slurs.

Urs



compound-slur-example-sorabij.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Urs Liska
One further iteration. Please let me know what you think of the interface:

-\compoundSlur \with {
  % offsets against the automatic control points
  offsets =   
  #'((0 . -1.5)   ; left starting point
  (-2 . -1)   ; second control point
  (2 . -5); second-to-last control point
  (0 . 0))% right end point

  inflection-ratio =
  #'(0.6 . 0.65)  % X/Y ratio of the inflection point
  % calculated between the actual end points of the slur
  % defaults to the center

  % Slope of the line around the inflection point
  % defaults to 1/1
  inflection-slope = 5/3

  % length of the "handles" around the inflection
  % given as a ratio to the left or right baseline
  % (distance between inflection point and slur's end point).
  % If not given they default to the length of the respective handle
  % on the left or right side
  inflection-ratio-right = 0.5
  inflection-ratio-left = 0.25
  
  % Display control points
  ann = ##t 
}

Of course one could use a list of unnamed arguments or an alist instead
of the \with {} clause (I just happen to like them). I have spiced up
the "annotation" even more compared to the last version (prints the
original slur and its control points in light gray in the background),
and I have the impression this approach to defining the inflection point
is quite natural, but I'm open to discussion.

One thing that is still missing from my personal wish list is a flag to
make the center symmetric again.

Urs


Am 19.09.2016 um 11:00 schrieb Urs Liska:
>
>
>
> Am 19.09.2016 um 00:32 schrieb David Kastrup:
>> Urs Liska  writes:
>>
>>> Am 18.09.2016 um 20:54 schrieb David Kastrup:
 Do you know how to split a bezier at a given ratio into equivalent
 beziers?  It's a comparatively simple operation and I think it's already
 somewhere in the C++ code though without access from Scheme.
>>> No, but I should be able to figure it out (if noone sends a pointer
>>> before I manage to do so).
>> Well, METAFONT uses the notation
>>
>> a[z1, z2]
>>
>> for z1 + a*[z2-z1], mapping a range of 0..1 for a linearly between z1
>> and z2.
>>
>> If we have points z1, z2, z3, z4 defining a Bezier, then the two split
>> beziers are defined with the points
>>
>> z1, a[z1, z2], a[a[z1, z2], a[z2, z3]], a[a[a[z1, z2], a[z2, z3]],
>>   a[a[z2, z3], a[z3, z4]]
>>
>> and
>>
>> a[a[a[z1, z2], a[z2, z3]], a[a[z2, z3], a[z3, z4]]],
>> a[a[z2, z3], a[z3, z4]], a[z3, z4], z4
>>
>> Basically, calculation of a point a on an n-grade Bezier is done using a
>> recursive formula to depth n, and keeping the intermediate results will
>> give you the control points for the Bezier curves split at that point.
>>
>
> I think before diving into that I share what I currently have, so we
> may discuss which approach should actually be continued.
>
> The attached solution does the following:
>
>   * Apply offsets for the start/end points and to the second and
> second-to-last control-points, based on the original points of the
> non-compound slur
>   * Add an inflection point, which is specified as a point between the
> (actual) end points of the slur, given X and Y ratios (as a pair
> of numbers between 0 and 1
>   * Determine the length and slope of the line going through the
> inflection point.
>   o Currently this is done through specifying one point relative
> to the inflection point and mirroring it symmetrically
>   o Instead I'd like to specify an angle and a length.
>   o It would be nice to have the angle relative to the slope of
> the slur as a whole, but that may not be a good idea, as we
> have actually two separate lines with different slopes
>   o Length should be given as a ratio, presumable relative to the
> length of the line between the inflection point and the
> respective end point.
>   o There should be one optional argument to enforce symmetrical
> points here.
>
> BTW I've spiced up the control points display a bit. I hope it's
> self-explanatory.
>
> I would like to integrate this with Janek's \shapeII functions
> (https://github.com/openlilylib/snippets/tree/master/notation-snippets/shaping-bezier-curves)
> as I think there'll be quite some code (and interface?) that can be
> shared.
>
> Opinions?
>
> Urs
>
>
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user


\version "2.19.47"
\language "deutsch"

%%%
% Display Configuration

#(define col-bg (rgb-color .9 .9 .8))
#(define col-orig-slur cyan)
#(define col-new-slur red)
#(define conn-thickness 0.05)
#(define cross-thickness 0.1)
#(define cross-size 0.2)

%%%
% Geometry helper functions

#(define (mirror-point pt1 pt2)
   "Mirror pt2 against pt1"
   (cons
(- (* 2 (car 

Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Urs Liska


Am 19.09.2016 um 00:32 schrieb David Kastrup:
> Urs Liska  writes:
>
>> Am 18.09.2016 um 20:54 schrieb David Kastrup:
>>> Do you know how to split a bezier at a given ratio into equivalent
>>> beziers?  It's a comparatively simple operation and I think it's already
>>> somewhere in the C++ code though without access from Scheme.
>> No, but I should be able to figure it out (if noone sends a pointer
>> before I manage to do so).
> Well, METAFONT uses the notation
>
> a[z1, z2]
>
> for z1 + a*[z2-z1], mapping a range of 0..1 for a linearly between z1
> and z2.
>
> If we have points z1, z2, z3, z4 defining a Bezier, then the two split
> beziers are defined with the points
>
> z1, a[z1, z2], a[a[z1, z2], a[z2, z3]], a[a[a[z1, z2], a[z2, z3]],
>   a[a[z2, z3], a[z3, z4]]
>
> and
>
> a[a[a[z1, z2], a[z2, z3]], a[a[z2, z3], a[z3, z4]]],
> a[a[z2, z3], a[z3, z4]], a[z3, z4], z4
>
> Basically, calculation of a point a on an n-grade Bezier is done using a
> recursive formula to depth n, and keeping the intermediate results will
> give you the control points for the Bezier curves split at that point.
>

I think before diving into that I share what I currently have, so we may
discuss which approach should actually be continued.

The attached solution does the following:

  * Apply offsets for the start/end points and to the second and
second-to-last control-points, based on the original points of the
non-compound slur
  * Add an inflection point, which is specified as a point between the
(actual) end points of the slur, given X and Y ratios (as a pair of
numbers between 0 and 1
  * Determine the length and slope of the line going through the
inflection point.
  o Currently this is done through specifying one point relative to
the inflection point and mirroring it symmetrically
  o Instead I'd like to specify an angle and a length.
  o It would be nice to have the angle relative to the slope of the
slur as a whole, but that may not be a good idea, as we have
actually two separate lines with different slopes
  o Length should be given as a ratio, presumable relative to the
length of the line between the inflection point and the
respective end point.
  o There should be one optional argument to enforce symmetrical
points here.

BTW I've spiced up the control points display a bit. I hope it's
self-explanatory.

I would like to integrate this with Janek's \shapeII functions
(https://github.com/openlilylib/snippets/tree/master/notation-snippets/shaping-bezier-curves)
as I think there'll be quite some code (and interface?) that can be shared.

Opinions?

Urs


\version "2.19.47"
\language "deutsch"
#(define (make-cross-stencil coord col)
   "Draw a cross-stencil at coord."
   (let ((thick 0.1)
 (sz 0.2))
 (stencil-with-color
  (ly:stencil-add
   (make-line-stencil
thick
(- (car coord) sz)
(- (cdr coord) sz)
(+ (car coord) sz)
(+ (cdr coord) sz))
   (make-line-stencil
thick
(- (car coord) sz)
(+ (cdr coord) sz)
(+ (car coord) sz)
(- (cdr coord) sz)))

  col)
 ))

#(define (connect-dots pt1 pt2 col)
   (stencil-with-color
(ly:stencil-add
 (make-line-stencil
  0.05
  (car pt1)
  (cdr pt1)
  (car pt2)
  (cdr pt2)))
col))

#(define (mirror-point pt1 pt2)
   "Mirror pt2 against pt1"
   (cons
(- (* 2 (car pt1)) (car pt2))
(- (* 2 (cdr pt1)) (cdr pt2

#(define (add-points pt1 pt2)
   "Add two points"
   (cons (+ (car pt1) (car pt2))
 (+ (cdr pt1) (cdr pt2

#(define (divide pt1 pt2 ratio)
   ""
   (let*
((x1 (car pt1))
 (x2 (car pt2))
 (y1 (cdr pt1))
 (y2 (cdr pt2))
 (xratio (car ratio))
 (yratio (cdr ratio))
 (newcenter(cons
(+ (* (- 1 xratio) x1) (* xratio x2))
(+ (* (- 1 yratio) y1) (* yratio y2)
(display newcenter)
newcenter))

#(define (distance pt1 pt2)
   (let
((square (lambda (x) (* x x
(sqrt
 (+
  (square (- (car pt1) (car pt2)))
  (square (- (cdr pt1) (cdr pt2)))

compoundSlur =
#(define-event-function (options)(ly:context-mod?)
   ; TODO: Change inner-segment to
   ; - a ratio (to the length of the line between cp1 and cp4)
   ; - an angle (relative to the same line cp1--cp2)
   (let
((proc
  (lambda (grob)
(let*
 ((opts (map (lambda (o)
   (cons (second o) (third o))) (ly:get-context-mods options)))
  ; TODO: factor out requiring/defaulting options
  ;; let offsets default to taking the control-points of the automatic slur
  (offsets
   (let ((prop (assq 'offsets opts)))
 (if prop (cdr prop) '((0 . 0)(0 . 0)(0 . 0)(0 . 0)
  ;; let center-ratio default to 0.5/0.5
  

Re: What to do wanting a 4th order Bézier?

2016-09-19 Thread Hans Åberg

> On 18 Sep 2016, at 14:41, Simon Albrecht  wrote:
> 
> On 18.09.2016 13:54, Andrew Bernard wrote:

>> What is it exactly that you are expecting a quartic to give you?
> 
> Oh, I think you’re quite overestimating the amount of in-depth mathematical 
> background I had – I just thought: ‘A 3rd order Bézier curve can have one 
> turning point, but I need two turning points, so I’d need a 4th order 
> Bézier’. Which I now see is wrong, after some experimenting with the 
> interactive fields in that article you linked: it requires a 5th order Bézier 
> for that, and then it already gets quite unhandy.

Curves of higher polynomial order did not catch on, because they are not 
stable: small changes in the input variables can sometimes cause dramatic 
effects in the output curve.



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Simon Albrecht

On 19.09.2016 00:07, Urs Liska wrote:

Am 18.09.2016 um 22:16 schrieb Thomas Morley:

Hi all,
I have my doubts we will ever find a possibility to do it reasonable automatic.

That's probably right. But I don't think that should necessarily prevent
us from including it as a built-in tool. This kind of slur will always
be a corner case of notation, and noone would expect a notation software
to handle it automatically. However, with something like we're building
here LilyPond will solve the problem better than the competition by
orders of magnitude.

Take m. 4 of the Ravel on p. 6 of
http://www.klemm-music.de/notation/november2/examples/November_2.0_Examples.pdf
as an example. The (manually tuned) rendering of LilyPond on
http://lilypondblog.org/2015/12/reveries-of-a-solitary-music-typographer-about-november-2-0/
is already better than Finale (IMO), but the point is that the Finale
solution is completely fragile when it comes to modifications of the layout.


What to do at linebreaks or if more than two splines are needed?

I think when we've settled about how to specify the compound slur it
won't be too complicated to find a solution where multiple splines can
be created when more than two sets of controls are given.

Handling at line breaks should be possible as well, and when an
(originally single) compound slur happens to be broken, a warning should
be sufficient (like with \shape).

Maybe it would be a good idea not to implement compound slurs as a
command but rather as an overridable property of the slur/tie/phrasingslur:

\once \override Slur.compound = ...


That would be great!
Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread David Kastrup
Urs Liska  writes:

> Am 18.09.2016 um 20:54 schrieb David Kastrup:

>>
>> Do you know how to split a bezier at a given ratio into equivalent
>> beziers?  It's a comparatively simple operation and I think it's already
>> somewhere in the C++ code though without access from Scheme.
>
> No, but I should be able to figure it out (if noone sends a pointer
> before I manage to do so).

Well, METAFONT uses the notation

a[z1, z2]

for z1 + a*[z2-z1], mapping a range of 0..1 for a linearly between z1
and z2.

If we have points z1, z2, z3, z4 defining a Bezier, then the two split
beziers are defined with the points

z1, a[z1, z2], a[a[z1, z2], a[z2, z3]], a[a[a[z1, z2], a[z2, z3]],
  a[a[z2, z3], a[z3, z4]]

and

a[a[a[z1, z2], a[z2, z3]], a[a[z2, z3], a[z3, z4]]],
a[a[z2, z3], a[z3, z4]], a[z3, z4], z4

Basically, calculation of a point a on an n-grade Bezier is done using a
recursive formula to depth n, and keeping the intermediate results will
give you the control points for the Bezier curves split at that point.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Carl Sorensen


On 9/18/16 12:54 PM, "David Kastrup"  wrote:

>
>Do you know how to split a bezier at a given ratio into equivalent
>beziers?  It's a comparatively simple operation and I think it's already
>somewhere in the C++ code though without access from Scheme.

see scm/bezier-tools.scm for a set of tools (including splitting a bezier).

We use it when making dashed slurs, because we need to split the bezier
sandwich into chunks that can each be drawn and filled in.

HTH,

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska


Am 18.09.2016 um 22:16 schrieb Thomas Morley:
> 2016-09-18 20:26 GMT+02:00 Urs Liska :
>> Am 18.09.2016 um 18:28 schrieb Simon Albrecht:
>>> May I incorporate that into the LSR version?
>>>
>>>
>> I suggest not to do anything right now. I assume that once I'll come up
>> with the next iteration there will be more things to be discussed. I
>> suggest to bring that to an end before deciding what to do with it.
>> Maybe it would be good to include to LilyPond itself instead of the LSR.
>>
>> Urs
> Hi all,
>
> I have my doubts we will ever find a possibility to do it reasonable 
> automatic.

That's probably right. But I don't think that should necessarily prevent
us from including it as a built-in tool. This kind of slur will always
be a corner case of notation, and noone would expect a notation software
to handle it automatically. However, with something like we're building
here LilyPond will solve the problem better than the competition by
orders of magnitude.

Take m. 4 of the Ravel on p. 6 of
http://www.klemm-music.de/notation/november2/examples/November_2.0_Examples.pdf
as an example. The (manually tuned) rendering of LilyPond on
http://lilypondblog.org/2015/12/reveries-of-a-solitary-music-typographer-about-november-2-0/
is already better than Finale (IMO), but the point is that the Finale
solution is completely fragile when it comes to modifications of the layout.

> What to do at linebreaks or if more than two splines are needed?

I think when we've settled about how to specify the compound slur it
won't be too complicated to find a solution where multiple splines can
be created when more than two sets of controls are given.

Handling at line breaks should be possible as well, and when an
(originally single) compound slur happens to be broken, a warning should
be sufficient (like with \shape).

Maybe it would be a good idea not to implement compound slurs as a
command but rather as an overridable property of the slur/tie/phrasingslur:

\once \override Slur.compound = ...
?

Urs

>
> You probably already know the most extreme case, from Sorabji's Opus
> Clavicembalisticum (1930):
> http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation_files/Sorabji_Slur+Ctxt.png
>
> The paper where the image is taken from lists some more extreme notations:
> http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation.html
>
> Cheers,
>   Harm


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska


Am 18.09.2016 um 20:54 schrieb David Kastrup:
> Urs Liska  writes:
>
>> I'm currently experimenting with this, giving it a somewhat more
>> straightforward interface similar to \shape, i.e. using offsets from the
>> automatic non-compound slur.
>>
>> My idea is to provide options that specify the angle and the length of
>> the "handle" (however one calls that virtual line connecting the control
>> points next to the inflection.
>> I'll take your suggestion and provide options to have that line
>> symmetric or to specify the two parts individually. However, I think a
>> straight line should be enforced.
> Sure, a continuous _first_ derivative is most certainly wanted.  Maybe
> we can take the default slur as a starting point?
>
> Then one would specify a split location (between 0 and 1) and then some
> number or numbers modifying the separate parts?  So that when those
> modifications are zero, the split pieces will just match the original
> slur?  Maybe just an offset to move the split point and an angle to
> twist its tangent?  So if the original points are
>
> A C1 C2 B
>
> we convert into the equivalent
>
> A C1 C12 S C21 C2 B
>
> and then manipulate C12/C21/S with a given shift/rotate transform (which
> will keep S on the straight line between C12 and C21) ?
>
> I have no idea whether this would work well/robustly.  This is just a
> brain storm.

I think it would work well. What's especially nice about that is that
the initial setting with default/zero values would result in a slur that
matches the original.

The approach I've started trying out is somewhat different. I calculated
your point S as a ratio between A and B (i.e. a parameter of '(0.6 .
0.5) would place that in the vertical center and slightly to the right
of the slur's end-points (*after* applying the offsets). There would be
offsets for C1 and C2, just like \shape expects. What I hadn't finally
thought of is how to specify the middle "line" C12--S--C21. (Still
assuming it to be symmetric) I thought of specifying a length as a ratio
of the length of A--B and an angle relative to the slope of A--B. I have
the hope that such an approach would be reasonably robust against
smaller layout changes.

I have no clear idea to prefer one approach over the other, so some more
opinions would be nice before starting to write any actual code.

>
> Do you know how to split a bezier at a given ratio into equivalent
> beziers?  It's a comparatively simple operation and I think it's already
> somewhere in the C++ code though without access from Scheme.

No, but I should be able to figure it out (if noone sends a pointer
before I manage to do so).

Urs

>


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread David Kastrup
Urs Liska  writes:

> I'm currently experimenting with this, giving it a somewhat more
> straightforward interface similar to \shape, i.e. using offsets from the
> automatic non-compound slur.
>
> My idea is to provide options that specify the angle and the length of
> the "handle" (however one calls that virtual line connecting the control
> points next to the inflection.
> I'll take your suggestion and provide options to have that line
> symmetric or to specify the two parts individually. However, I think a
> straight line should be enforced.

Sure, a continuous _first_ derivative is most certainly wanted.  Maybe
we can take the default slur as a starting point?

Then one would specify a split location (between 0 and 1) and then some
number or numbers modifying the separate parts?  So that when those
modifications are zero, the split pieces will just match the original
slur?  Maybe just an offset to move the split point and an angle to
twist its tangent?  So if the original points are

A C1 C2 B

we convert into the equivalent

A C1 C12 S C21 C2 B

and then manipulate C12/C21/S with a given shift/rotate transform (which
will keep S on the straight line between C12 and C21) ?

I have no idea whether this would work well/robustly.  This is just a
brain storm.

Do you know how to split a bezier at a given ratio into equivalent
beziers?  It's a comparatively simple operation and I think it's already
somewhere in the C++ code though without access from Scheme.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Thomas Morley
2016-09-18 20:26 GMT+02:00 Urs Liska :
> Am 18.09.2016 um 18:28 schrieb Simon Albrecht:
>> May I incorporate that into the LSR version?
>>
>>
>
> I suggest not to do anything right now. I assume that once I'll come up
> with the next iteration there will be more things to be discussed. I
> suggest to bring that to an end before deciding what to do with it.
> Maybe it would be good to include to LilyPond itself instead of the LSR.
>
> Urs

Hi all,

I have my doubts we will ever find a possibility to do it reasonable automatic.
What to do at linebreaks or if more than two splines are needed?

You probably already know the most extreme case, from Sorabji's Opus
Clavicembalisticum (1930):
http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation_files/Sorabji_Slur+Ctxt.png

The paper where the image is taken from lists some more extreme notations:
http://homes.soic.indiana.edu/donbyrd/InterestingMusicNotation.html

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska
Am 18.09.2016 um 18:28 schrieb Simon Albrecht:
> May I incorporate that into the LSR version?
> 
> 

I suggest not to do anything right now. I assume that once I'll come up
with the next iteration there will be more things to be discussed. I
suggest to bring that to an end before deciding what to do with it.
Maybe it would be good to include to LilyPond itself instead of the LSR.

Urs

> On 18.09.2016 16:04, Urs Liska wrote:
>>
>> Am 18.09.2016 um 16:01 schrieb Urs Liska:
>>>(cps (ly:slur::calc-control-points grob))
>>>(cps1 (first contr-pts))
>>>(cps2 (second contr-pts))
>>>(cp2-2 (mirror-point (fourth cps1) (third
>>> cps1)))
>>>(cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))
>> This should actually read
>>
>>(cps (ly:slur::calc-control-points grob))
>>(cps1 (first contr-pts))
>>(cp2-2 (mirror-point (fourth cps1) (third
>> cps1)))
>>(cps2 `(,(fourth cps1) ,cp2-2 ,@(second
>> contr-pts)))
>>
>> Urs
>>
>> ___
>> lilypond-user mailing list
>> lilypond-user@gnu.org
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
> 


-- 
Urs Liska
www.openlilylib.org

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska
Am 18.09.2016 um 19:28 schrieb David Kastrup:
> Simon Albrecht  writes:
> 
>> May I incorporate that into the LSR version?
>>
>>
>> On 18.09.2016 16:04, Urs Liska wrote:
>>>
>>> Am 18.09.2016 um 16:01 schrieb Urs Liska:
(cps (ly:slur::calc-control-points grob))
(cps1 (first contr-pts))
(cps2 (second contr-pts))
(cp2-2 (mirror-point (fourth cps1) (third 
 cps1)))
(cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))
>>> This should actually read
>>>
>>>(cps (ly:slur::calc-control-points grob))
>>>(cps1 (first contr-pts))
>>>(cp2-2 (mirror-point (fourth cps1) (third cps1)))
>>>(cps2 `(,(fourth cps1) ,cp2-2 ,@(second
>>> contr-pts)))
> 
> I think this may actually be overdoing the symmetry since it forces the
> control points around the inflection point to not just have the same
> tangent but also the same distance (resulting, if I judge correctly, in
> the same curvature).  That is actually providing more continuity than
> warranted: the whole point of having multiple slur pieces is that a
> single consistent bezier is not enough to reflect the problem space.
> 
> So maybe it would be warranted to express the usefully available degrees
> of freedom differently than by control points?

I'm currently experimenting with this, giving it a somewhat more
straightforward interface similar to \shape, i.e. using offsets from the
automatic non-compound slur.

My idea is to provide options that specify the angle and the length of
the "handle" (however one calls that virtual line connecting the control
points next to the inflection.
I'll take your suggestion and provide options to have that line
symmetric or to specify the two parts individually. However, I think a
straight line should be enforced.

Urs

> 


-- 
Urs Liska
www.openlilylib.org

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread David Kastrup
Simon Albrecht  writes:

> May I incorporate that into the LSR version?
>
>
> On 18.09.2016 16:04, Urs Liska wrote:
>>
>> Am 18.09.2016 um 16:01 schrieb Urs Liska:
>>>(cps (ly:slur::calc-control-points grob))
>>>(cps1 (first contr-pts))
>>>(cps2 (second contr-pts))
>>>(cp2-2 (mirror-point (fourth cps1) (third cps1)))
>>>(cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))
>> This should actually read
>>
>>(cps (ly:slur::calc-control-points grob))
>>(cps1 (first contr-pts))
>>(cp2-2 (mirror-point (fourth cps1) (third cps1)))
>>(cps2 `(,(fourth cps1) ,cp2-2 ,@(second
>> contr-pts)))

I think this may actually be overdoing the symmetry since it forces the
control points around the inflection point to not just have the same
tangent but also the same distance (resulting, if I judge correctly, in
the same curvature).  That is actually providing more continuity than
warranted: the whole point of having multiple slur pieces is that a
single consistent bezier is not enough to reflect the problem space.

So maybe it would be warranted to express the usefully available degrees
of freedom differently than by control points?

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Simon Albrecht

May I incorporate that into the LSR version?


On 18.09.2016 16:04, Urs Liska wrote:


Am 18.09.2016 um 16:01 schrieb Urs Liska:

   (cps (ly:slur::calc-control-points grob))
   (cps1 (first contr-pts))
   (cps2 (second contr-pts))
   (cp2-2 (mirror-point (fourth cps1) (third cps1)))
   (cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))

This should actually read

   (cps (ly:slur::calc-control-points grob))
   (cps1 (first contr-pts))
   (cp2-2 (mirror-point (fourth cps1) (third cps1)))
   (cps2 `(,(fourth cps1) ,cp2-2 ,@(second
contr-pts)))

Urs

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska


Am 18.09.2016 um 16:01 schrieb Urs Liska:
>   (cps (ly:slur::calc-control-points grob))
>   (cps1 (first contr-pts))
>   (cps2 (second contr-pts))
>   (cp2-2 (mirror-point (fourth cps1) (third cps1)))
>   (cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))

This should actually read

  (cps (ly:slur::calc-control-points grob))
  (cps1 (first contr-pts))
  (cp2-2 (mirror-point (fourth cps1) (third cps1)))
  (cps2 `(,(fourth cps1) ,cp2-2 ,@(second
contr-pts)))

Urs

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Kieren MacMillan
Hi Simon,

> I added the new version to the LSR 

Wonderful!

Thanks,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Kieren MacMillan
Hi Urs,

> There's another improvement I'm right now experimenting with: Not having
> to type the second control point of the second spline but calculating
> that mirroring it from the third one of the first spline.

I <3 U.  =)

> After that I would like to suggest looking for a solution that will
> enable passing the control points as offsets against the default
> (non-compound) slur, like \shape does.

I <3 U mor.

Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska


Am 18.09.2016 um 15:49 schrieb Urs Liska:
>
> Am 18.09.2016 um 15:38 schrieb Simon Albrecht:
>> On 18.09.2016 15:15, Kieren MacMillan wrote:
 And finally with a better user interface
>>> Under what circumstances would you NOT want the end of one curve to
>>> match precisely the beginning of the next one?
>>> If “none”, then I would say an even better user interface would not
>>> require typing that set of coordinates twice.
>> I thought about that too – it also makes the data structure less
>> complicated if it’s a list of seven pairs. I added the new version to
>> the LSR , awaiting approval.
> There's another improvement I'm right now experimenting with: Not having
> to type the second control point of the second spline but calculating
> that mirroring it from the third one of the first spline. I noticed that
> the compound slur had a noticeable angle there, so this improvement will
> not only require one point less to type (and determine) but also ensure
> a smooth turning point.


\version "2.19.47"
\language "deutsch"
#(define (make-cross-stencil coord)
   "Draw a cross-stencil at coord."
   (let ((thick 0.1)
 (sz 0.2))
 (stencil-with-color
  (ly:stencil-add
   (make-line-stencil
thick
(- (car coord) sz)
(- (cdr coord) sz)
(+ (car coord) sz)
(+ (cdr coord) sz))
   (make-line-stencil
thick
(- (car coord) sz)
(+ (cdr coord) sz)
(+ (car coord) sz)
(- (cdr coord) sz)))

  cyan)
 ))

#(define (mirror-point pt1 pt2)
   "Mirror pt2 against pt1"
   (cons
(- (* 2 (car pt1)) (car pt2))
(- (* 2 (cdr pt1)) (cdr pt2

compoundSlur =
#(define-event-function (contr-pts ann?) (list? boolean?)
   (let ((proc (lambda (grob)
 (let*  (;; only here for reference:
  (cps (ly:slur::calc-control-points grob))
  (cps1 (first contr-pts))
  (cps2 (second contr-pts))
  (cp2-2 (mirror-point (fourth cps1) (third cps1)))
  (cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))
  (first-spline-stil
   (begin
(ly:grob-set-property! grob 'control-points
cps1)
(ly:slur::print grob)))
  (second-spline-stil
   (begin
(ly:grob-set-property! grob 'control-points
cps2)
(ly:slur::print grob)))
  ;; annotates all new control-points
  (crosses
   (if ann?
   (apply
ly:stencil-add
(map
 (lambda (c)
   (make-cross-stencil c))
 (append cps1 cps2)))
   empty-stencil))
  )
   (display cps2)(newline)
   ;(pretty-print cps)
   ;; returns
   ;;  ((0.631380973009261 . 7.545004)
   ;;   (3.65053718406404 . 9.82511349243875)
   ;;   (53.1972252988833 . 16.0566485774538)
   ;;   (56.6869647738747 . 14.5951692170292))

   (ly:stencil-add
first-spline-stil
second-spline-stil
crosses
)
 #{ -\tweak stencil $proc ( #}))
cptsA = #'(((0.6 . 5.8)
(2 . 9)
(26.0 . 5.0)
(32 . 12))
   ((53.1 . 16.0)
(55.5 . 12.5)))

upper = \relative {
  \key d \major
  \clef bass
  s2 r8 d,16 g h d g h
  d8 r s2.
  s4 \voiceTwo h8.(-- c16-- h2--)
}
lower = \relative {
  \key d \major
  \clef bass
  r2
  ~-^-\compoundSlur \cptsA ##t
  <<
{
  4   \voiceOne cis
  \change Staff = upper
  \clef treble \voiceOne d e fis2)
  \fermata
}
\new Voice {
  \voiceTwo
  s2. 4 \oneVoice
2\fermata
}
  >>
}
\score {
  <<
\new PianoStaff <<
  \new Staff = upper \upper
  \new Staff = lower \lower
>>
  >>
}
%%%

>
> After that I would like to suggest looking for a solution that will
> enable passing the control points as offsets against the default
> (non-compound) slur, like \shape does.
>
> Urs
>
>> Best, Simon
>>
>> ___
>> lilypond-user mailing list
>> lilypond-user@gnu.org
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list

Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Urs Liska


Am 18.09.2016 um 15:38 schrieb Simon Albrecht:
> On 18.09.2016 15:15, Kieren MacMillan wrote:
>>> And finally with a better user interface
>> Under what circumstances would you NOT want the end of one curve to
>> match precisely the beginning of the next one?
>> If “none”, then I would say an even better user interface would not
>> require typing that set of coordinates twice.
>
> I thought about that too – it also makes the data structure less
> complicated if it’s a list of seven pairs. I added the new version to
> the LSR , awaiting approval.

There's another improvement I'm right now experimenting with: Not having
to type the second control point of the second spline but calculating
that mirroring it from the third one of the first spline. I noticed that
the compound slur had a noticeable angle there, so this improvement will
not only require one point less to type (and determine) but also ensure
a smooth turning point.

After that I would like to suggest looking for a solution that will
enable passing the control points as offsets against the default
(non-compound) slur, like \shape does.

Urs

>
> Best, Simon
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Simon Albrecht

On 18.09.2016 15:15, Kieren MacMillan wrote:

And finally with a better user interface

Under what circumstances would you NOT want the end of one curve to match 
precisely the beginning of the next one?
If “none”, then I would say an even better user interface would not require 
typing that set of coordinates twice.


I thought about that too – it also makes the data structure less 
complicated if it’s a list of seven pairs. I added the new version to 
the LSR , awaiting approval.


Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Kieren MacMillan
Hi Simon,

> And finally with a better user interface

Under what circumstances would you NOT want the end of one curve to match 
precisely the beginning of the next one?
If “none”, then I would say an even better user interface would not require 
typing that set of coordinates twice.

In any case, thanks to you and Harm for putting this together — it definitely 
improves on my attempt.

Best,
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


[OT] Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Kieren MacMillan
Hi Andrew,

Quite independent of the actual question in this thread, thank you for the 
wonderful link on Bezier curves!
I have bookmarked it, in anticipation of reading it in depth one day.

Best,
Kieren.

> Just because this is so well written and one of the best elementary 
> expositions of Bezier curve maths I have come across, here’s a useful link:
> http://pomax.github.io/bezierinfo/


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Simon Albrecht

On 18.09.2016 13:54, Andrew Bernard wrote:

Hello Simon,

Others have of course already replied, but when I look at your attached sample 
I only see a slightly curved slur. What makes you say you want a quartic bezier 
curve? I can’t quite see it.

Are you sure that’s what you want in any case? Quickly scanning through some of 
the maths of bezier curves and splines, it seems that people are pretty much in 
agreement that curves higher than cubic are problematical in many ways, and 
that the way to deal with non cubic representable curves is to piecewise 
approximate them with cubic beziers. This is from the point of view of maths, 
and all the answers here give the practical way of doing that in lilypond.

What is it exactly that you are expecting a quartic to give you?


Oh, I think you’re quite overestimating the amount of in-depth 
mathematical background I had – I just thought: ‘A 3rd order Bézier 
curve can have one turning point, but I need two turning points, so I’d 
need a 4th order Bézier’. Which I now see is wrong, after some 
experimenting with the interactive fields in that article you linked: it 
requires a 5th order Bézier for that, and then it already gets quite 
unhandy.
But now I know that the goal is much better achieved by linking two 
cubic ones. As is said in the article: ‘you can link up multiple Bézier 
curves so that the combination looks like a single curve.’
So – problem solved (if also the control points have to be specified 
manually…).


Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-18 Thread Andrew Bernard
Hello Simon,

Others have of course already replied, but when I look at your attached sample 
I only see a slightly curved slur. What makes you say you want a quartic bezier 
curve? I can’t quite see it.

Are you sure that’s what you want in any case? Quickly scanning through some of 
the maths of bezier curves and splines, it seems that people are pretty much in 
agreement that curves higher than cubic are problematical in many ways, and 
that the way to deal with non cubic representable curves is to piecewise 
approximate them with cubic beziers. This is from the point of view of maths, 
and all the answers here give the practical way of doing that in lilypond.

What is it exactly that you are expecting a quartic to give you?

Just because this is so well written and one of the best elementary expositions 
of Bezier curve maths I have come across, here’s a useful link:

http://pomax.github.io/bezierinfo/


Andrew





On 18/09/2016, 4:27 AM, "lilypond-user on behalf of Simon Albrecht" 
 wrote:

Hello folks,

I’m attaching an excerpt from my current project, where I’d actually 
really need a 4th order Bézier slur – but that’s impossible with Lily 
now. Unfortunately I also lack an idea what else to do in this situation 
– I’d like to avoid an extra staff…
Any ideas?

Best, Simon
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Thomas Morley
2016-09-17 23:47 GMT+02:00 Urs Liska :
>
>
> Am 17. September 2016 23:10:08 MESZ, schrieb Simon Albrecht 
> :
>>And finally with a better user interface:
>>
>
> I'll have to look it up (and probably update it to handle current LilyPond),  
> but Frescobaldi can display control points with the Layout Control Options 
> tool (and this is of course based on code by Harm).



Think so, yes.
But here not the default is displayed.
And some people (like me) don't use Frescobaldi ;)

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Urs Liska


Am 17. September 2016 23:10:08 MESZ, schrieb Simon Albrecht 
:
>And finally with a better user interface:
>

I'll have to look it up (and probably update it to handle current LilyPond),  
but Frescobaldi can display control points with the Layout Control Options tool 
(and this is of course based on code by Harm).

HTH
Urs




>
>\version "2.19.47"
>\language "deutsch"
>#(define (make-cross-stencil coord)
>"Draw a cross-stencil at coord."
>(let ((thick 0.1)
>  (sz 0.2))
>  (stencil-with-color
>   (ly:stencil-add
>(make-line-stencil
> thick
> (- (car coord) sz)
> (- (cdr coord) sz)
> (+ (car coord) sz)
> (+ (cdr coord) sz))
>(make-line-stencil
> thick
> (- (car coord) sz)
> (+ (cdr coord) sz)
> (+ (car coord) sz)
> (- (cdr coord) sz)))
>
>   cyan)
>  ))
>compoundSlur =
>#(define-event-function (contr-pts ann?) (list? boolean?)
>(let ((proc (lambda (grob)
>  (let*  (;; only here for reference:
>   (cps (ly:slur::calc-control-points grob))
>   (cps1 (first contr-pts))
>   (cps2 (second contr-pts))
>   (first-spline-stil
>(begin
>   (ly:grob-set-property! grob 'control-points 
>cps1)
> (ly:slur::print grob)))
>   (second-spline-stil
>(begin
>   (ly:grob-set-property! grob 'control-points 
>cps2)
> (ly:slur::print grob)))
>   ;; annotates all new control-points
>   (crosses
>(if ann?
>(apply
> ly:stencil-add
> (map
>  (lambda (c)
>(make-cross-stencil c))
>  (append cps1 cps2)))
>empty-stencil))
>   )
>;(pretty-print cps)
>;; returns
>;;  ((0.631380973009261 . 7.545004)
>;;   (3.65053718406404 . 9.82511349243875)
>;;   (53.1972252988833 . 16.0566485774538)
>;;   (56.6869647738747 . 14.5951692170292))
>
>(ly:stencil-add
> first-spline-stil
> second-spline-stil
> crosses
> )
>  #{ -\tweak stencil $proc ( #}))
>cptsA = #'(((0.6 . 5.8)
> (3.6 . 7.8)
> (25.0 . 5.0)
> (32 . 12))
>((32 . 12)
> (39.0 . 17.5)
> (53.1 . 16.0)
> (55.5 . 12.5)))
>
>upper = \relative {
>   \key d \major
>   \clef bass
>   s2 r8 d,16 g h d g h
>   d8 r s2.
>   s4 \voiceTwo h8.(-- c16-- h2--)
>}
>lower = \relative {
>   \key d \major
>   \clef bass
>   r2
>   ~-^-\compoundSlur \cptsA ##t
>   <<
> {
>   4   \voiceOne cis
>   \change Staff = upper
>   \clef treble \voiceOne d e fis2)
>   \fermata
> }
> \new Voice {
>   \voiceTwo
>   s2. 4 \oneVoice
> 2\fermata
> }
>   >>
>}
>\score {
>   <<
> \new PianoStaff <<
>   \new Staff = upper \upper
>   \new Staff = lower \lower
> >>
>   >>
>}
>%%%
>
>Thanks a lot!
>Simon
>
>
>On 17.09.2016 22:39, Thomas Morley wrote:
>> 2016-09-17 21:50 GMT+02:00 Simon Albrecht :
>>
>>> Only one glitch: Is make-cross-stencil a private function of yours?
>> Aaarrrgh, forgot to include. Sorry for that.
>>
>> #(define (make-cross-stencil coord)
>>"Draw a cross-stencil at coord."
>>(let ((thick 0.1)
>>  (sz 0.2))
>>(stencil-with-color
>>  (ly:stencil-add
>>(make-line-stencil
>>  thick
>>  (- (car coord) sz)
>>  (- (cdr coord) sz)
>>  (+ (car coord) sz)
>>  (+ (cdr coord) sz))
>>(make-line-stencil
>>  thick
>>  (- (car coord) sz)
>>  (+ (cdr coord) sz)
>>  (+ (car coord) sz)
>>  (- (cdr coord) sz)))
>>
>>cyan)
>>))
>>
>> Cheers,
>>Harm
>
>
>___
>lilypond-user mailing list
>lilypond-user@gnu.org
>https://lists.gnu.org/mailman/listinfo/lilypond-user

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Simon Albrecht

And finally with a better user interface:


\version "2.19.47"
\language "deutsch"
#(define (make-cross-stencil coord)
   "Draw a cross-stencil at coord."
   (let ((thick 0.1)
 (sz 0.2))
 (stencil-with-color
  (ly:stencil-add
   (make-line-stencil
thick
(- (car coord) sz)
(- (cdr coord) sz)
(+ (car coord) sz)
(+ (cdr coord) sz))
   (make-line-stencil
thick
(- (car coord) sz)
(+ (cdr coord) sz)
(+ (car coord) sz)
(- (cdr coord) sz)))

  cyan)
 ))
compoundSlur =
#(define-event-function (contr-pts ann?) (list? boolean?)
   (let ((proc (lambda (grob)
 (let*  (;; only here for reference:
  (cps (ly:slur::calc-control-points grob))
  (cps1 (first contr-pts))
  (cps2 (second contr-pts))
  (first-spline-stil
   (begin
(ly:grob-set-property! grob 'control-points 
cps1)

(ly:slur::print grob)))
  (second-spline-stil
   (begin
(ly:grob-set-property! grob 'control-points 
cps2)

(ly:slur::print grob)))
  ;; annotates all new control-points
  (crosses
   (if ann?
   (apply
ly:stencil-add
(map
 (lambda (c)
   (make-cross-stencil c))
 (append cps1 cps2)))
   empty-stencil))
  )
   ;(pretty-print cps)
   ;; returns
   ;;  ((0.631380973009261 . 7.545004)
   ;;   (3.65053718406404 . 9.82511349243875)
   ;;   (53.1972252988833 . 16.0566485774538)
   ;;   (56.6869647738747 . 14.5951692170292))

   (ly:stencil-add
first-spline-stil
second-spline-stil
crosses
)
 #{ -\tweak stencil $proc ( #}))
cptsA = #'(((0.6 . 5.8)
(3.6 . 7.8)
(25.0 . 5.0)
(32 . 12))
   ((32 . 12)
(39.0 . 17.5)
(53.1 . 16.0)
(55.5 . 12.5)))

upper = \relative {
  \key d \major
  \clef bass
  s2 r8 d,16 g h d g h
  d8 r s2.
  s4 \voiceTwo h8.(-- c16-- h2--)
}
lower = \relative {
  \key d \major
  \clef bass
  r2
  ~-^-\compoundSlur \cptsA ##t
  <<
{
  4   \voiceOne cis
  \change Staff = upper
  \clef treble \voiceOne d e fis2)
  \fermata
}
\new Voice {
  \voiceTwo
  s2. 4 \oneVoice
2\fermata
}
  >>
}
\score {
  <<
\new PianoStaff <<
  \new Staff = upper \upper
  \new Staff = lower \lower
>>
  >>
}
%%%

Thanks a lot!
Simon


On 17.09.2016 22:39, Thomas Morley wrote:

2016-09-17 21:50 GMT+02:00 Simon Albrecht :


Only one glitch: Is make-cross-stencil a private function of yours?

Aaarrrgh, forgot to include. Sorry for that.

#(define (make-cross-stencil coord)
   "Draw a cross-stencil at coord."
   (let ((thick 0.1)
 (sz 0.2))
   (stencil-with-color
 (ly:stencil-add
   (make-line-stencil
 thick
 (- (car coord) sz)
 (- (cdr coord) sz)
 (+ (car coord) sz)
 (+ (cdr coord) sz))
   (make-line-stencil
 thick
 (- (car coord) sz)
 (+ (cdr coord) sz)
 (+ (car coord) sz)
 (- (cdr coord) sz)))

   cyan)
   ))

Cheers,
   Harm



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Thomas Morley
2016-09-17 21:50 GMT+02:00 Simon Albrecht :

> Only one glitch: Is make-cross-stencil a private function of yours?

Aaarrrgh, forgot to include. Sorry for that.

#(define (make-cross-stencil coord)
  "Draw a cross-stencil at coord."
  (let ((thick 0.1)
(sz 0.2))
  (stencil-with-color
(ly:stencil-add
  (make-line-stencil
thick
(- (car coord) sz)
(- (cdr coord) sz)
(+ (car coord) sz)
(+ (cdr coord) sz))
  (make-line-stencil
thick
(- (car coord) sz)
(+ (cdr coord) sz)
(+ (car coord) sz)
(- (cdr coord) sz)))

  cyan)
  ))

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Simon Albrecht

On 17.09.2016 21:34, Thomas Morley wrote:

2016-09-17 20:45 GMT+02:00 Kieren MacMillan :

Hi Simon,


I’m attaching an excerpt from my current project, where I’d actually really 
need a 4th order Bézier slur – but that’s impossible with Lily now. 
Unfortunately I also lack an idea what else to do in this situation – I’d like 
to avoid an extra staff…
Any ideas?

What about something like this "compound slur"?
(Obviously, you could/should spend more time to really make the slur nice.)

%%%  SNIPPET BEGINS

(snipped snippet)


Hope that helps!
Kieren.



Hi Simon,

Kieren already demonstrated a possible workaround.

Below my own approach, probably a very first step in the direction
David mentioned.
You'll need to find all the values manually. Displaying the original
control-points and/or making the new ones visible with those crosses
may help.


Thanks a lot for that! Quite nice in the output.
Only one glitch: Is make-cross-stencil a private function of yours?

Best, Simon

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Thomas Morley
2016-09-17 20:45 GMT+02:00 Kieren MacMillan :
> Hi Simon,
>
>> I’m attaching an excerpt from my current project, where I’d actually really 
>> need a 4th order Bézier slur – but that’s impossible with Lily now. 
>> Unfortunately I also lack an idea what else to do in this situation – I’d 
>> like to avoid an extra staff…
>> Any ideas?
>
> What about something like this "compound slur"?
> (Obviously, you could/should spend more time to really make the slur nice.)
>
> %%%  SNIPPET BEGINS
> \version "2.19.46"
> \language "deutsch"
>
> slurfixA = {
>   \shape #'((1 . -2.625) (2 . 1) (-32 . -14) (-28.25 . -5)) Slur
> }
> slurfixB = {
>   \shape #'((0 . 1.5) (4 . 6) (-4 . 2) (-0.5 . -3)) Slur
> }
>
> upper = \relative {
>   \key d \major
>   \clef bass
>   s2 r8 d,16 g h d g h
>   d8 r s2.
>   s4 \voiceTwo h8.(-- c16-- h2--)
> }
> lower = \relative {
>   \key d \major
>   \clef bass
>   r2 \slurfixA ~-^\=1(
>   <<
> {
>   4 \slurfixB \=2(  \voiceOne cis
>   \change Staff = upper
>   \clef treble \voiceOne d e fis2\=1)\=2)\fermata
> }
> \new Voice {
>   \voiceTwo
>   s2. 4 \oneVoice
> 2\fermata
> }
>   >>
> }
> \score {
>   <<
> \new PianoStaff <<
>   \new Staff = upper \upper
>   \new Staff = lower \lower
> >>
>   >>
> }
> %%%  SNIPPET ENDS
>
> Hope that helps!
> Kieren.



Hi Simon,

Kieren already demonstrated a possible workaround.

Below my own approach, probably a very first step in the direction
David mentioned.
You'll need to find all the values manually. Displaying the original
control-points and/or making the new ones visible with those crosses
may help.

\version "2.19.47"
\language "deutsch"

#(define (proc grob)
  (let*  (;; only here for reference:
  (cps (ly:slur::calc-control-points grob))
  (cps1
'((0.6 . 5.8)
  (3.6 . 7.8)
  (25.0 . 5.0)
  (32 . 12)))
  (cps2
'((32 . 12)
  (39.0 . 17.5)
  (53.1 . 16.0)
  (55.5 . 12.5)))
  (first-spline-stil
(begin
  (ly:grob-set-property! grob 'control-points cps1)
  (ly:slur::print grob)))
  (second-spline-stil
(begin
  (ly:grob-set-property! grob 'control-points cps2)
  (ly:slur::print grob)))
  ;; annotates all new control-points
  (crosses
(apply
  ly:stencil-add
  (map
(lambda (c)
  (make-cross-stencil c))
(append cps1 cps2
)
  ;(pretty-print cps)
  ;; returns
  ;;  ((0.631380973009261 . 7.545004)
  ;;   (3.65053718406404 . 9.82511349243875)
  ;;   (53.1972252988833 . 16.0566485774538)
  ;;   (56.6869647738747 . 14.5951692170292))

  (ly:stencil-add
first-spline-stil
second-spline-stil
;; comment next line to get rid of the crosses
crosses
)))

upper = \relative {
  \key d \major
  \clef bass
  s2 r8 d,16 g h d g h
  d8 r s2.
  s4 \voiceTwo h8.(-- c16-- h2--)
}
lower = \relative {
  \key d \major
  \clef bass
  r2
  \override Slur.stencil = #proc
  ~-^(
  <<
{
  4   \voiceOne cis
  \change Staff = upper
  \clef treble \voiceOne d e fis2)
  \fermata
}
\new Voice {
  \voiceTwo
  s2. 4 \oneVoice
2\fermata
}
  >>
}
\score {
  <<
\new PianoStaff <<
  \new Staff = upper \upper
  \new Staff = lower \lower
>>
  >>
}


Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Kieren MacMillan
Hi Simon,

> I’m attaching an excerpt from my current project, where I’d actually really 
> need a 4th order Bézier slur – but that’s impossible with Lily now. 
> Unfortunately I also lack an idea what else to do in this situation – I’d 
> like to avoid an extra staff…
> Any ideas?

What about something like this "compound slur"?
(Obviously, you could/should spend more time to really make the slur nice.)

%%%  SNIPPET BEGINS
\version "2.19.46"
\language "deutsch"

slurfixA = {
  \shape #'((1 . -2.625) (2 . 1) (-32 . -14) (-28.25 . -5)) Slur
}
slurfixB = {
  \shape #'((0 . 1.5) (4 . 6) (-4 . 2) (-0.5 . -3)) Slur
}

upper = \relative {
  \key d \major
  \clef bass
  s2 r8 d,16 g h d g h
  d8 r s2.
  s4 \voiceTwo h8.(-- c16-- h2--)
}
lower = \relative {
  \key d \major
  \clef bass
  r2 \slurfixA ~-^\=1(
  <<
{
  4 \slurfixB \=2(  \voiceOne cis
  \change Staff = upper
  \clef treble \voiceOne d e fis2\=1)\=2)\fermata
}
\new Voice {
  \voiceTwo
  s2. 4 \oneVoice
2\fermata
}
  >>
}
\score {
  <<
\new PianoStaff <<
  \new Staff = upper \upper
  \new Staff = lower \lower
>>
  >>
}
%%%  SNIPPET ENDS

Hope that helps!
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread David Kastrup
Simon Albrecht  writes:

> Hello folks,
>
> I’m attaching an excerpt from my current project, where I’d actually
> really need a 4th order Bézier slur – but that’s impossible with Lily
> now. Unfortunately I also lack an idea what else to do in this
> situation – I’d like to avoid an extra staff…

That really does not look to me like you want a "4th order Bézier slur"
rather than a slur consisting of more than one piece.

I think it should be reasonably implementable to have slurs of more than
one segment as long as the _automatic_ slurs stay as they are.  With
regard to automatic slurs, one would probably want to have some measure
regarding slur badness and only attempt splitting into multiple segments
when that is pretty bad.

But the first step would be to allow for manually specified
multi-segment slurs.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: What to do wanting a 4th order Bézier?

2016-09-17 Thread Simon Albrecht

On 17.09.2016 20:27, Simon Albrecht wrote:

Hello folks,

I’m attaching an excerpt from my current project, where I’d actually 
really need a 4th order Bézier slur – but that’s impossible with Lily 
now. Unfortunately I also lack an idea what else to do in this 
situation – I’d like to avoid an extra staff…

Any ideas?

Best, Simon


Here’s the code as well.
\version "2.19.47"
\language "deutsch"

upper = \relative {
  \key d \major
  \clef bass
  s2 r8 d,16 g h d g h
  d8 r s2.
  s4 \voiceTwo h8.(-- c16-- h2--)
}
lower = \relative {
  \key d \major
  \clef bass
  r2 ~-^(
  <<
{
  4   \voiceOne cis
  \change Staff = upper
  \clef treble \voiceOne d e fis2)\fermata
}
\new Voice {
  \voiceTwo
  s2. 4 \oneVoice
2\fermata
}
  >>
}
\score {
  <<
\new PianoStaff <<
  \new Staff = upper \upper
  \new Staff = lower \lower
>>
  >>
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


What to do wanting a 4th order Bézier?

2016-09-17 Thread Simon Albrecht

Hello folks,

I’m attaching an excerpt from my current project, where I’d actually 
really need a 4th order Bézier slur – but that’s impossible with Lily 
now. Unfortunately I also lack an idea what else to do in this situation 
– I’d like to avoid an extra staff…

Any ideas?

Best, Simon
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user