lilypond-user
[Top][All Lists]
Advanced

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

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


From: David Kastrup
Subject: Re: What to do wanting a 4th order Bézier?
Date: Mon, 19 Sep 2016 00:32:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Urs Liska <address@hidden> 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



reply via email to

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