Urs Liska <u...@openlilylib.org> 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]]


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

Reply via email to