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

```
Am 18.09.2016 um 20:54 schrieb David Kastrup:
> Urs Liska <u...@openlilylib.org> 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
```