lilypond-devel
[Top][All Lists]
Advanced

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

Re: Does better polynomial calculations for avoid objects. (issue 486004


From: Joe Neeman
Subject: Re: Does better polynomial calculations for avoid objects. (issue 4860042)
Date: Thu, 25 Aug 2011 09:03:07 -0700

On Tue, Aug 23, 2011 at 12:36 AM, Mike Solomon <address@hidden> wrote:
> On Aug 23, 2011, at 6:55 AM, address@hidden wrote:
>
>>
>> http://codereview.appspot.com/4860042/diff/1/lily/bezier.cc
>> File lily/bezier.cc (right):
>>
>> http://codereview.appspot.com/4860042/diff/1/lily/bezier.cc#newcode239
>> lily/bezier.cc:239: return p.minmax (sol[LEFT][0], sol[RIGHT][0], d !=
>> LEFT);
>> On 2011/08/19 07:03:50, MikeSol wrote:
>>> On 2011/08/18 21:36:45, joeneeman wrote:
>>> > If there are multiple intersections with (say) r, then
>> Polynomial::solve
>>> doesn't
>>> > seem to return them in any useful order. So sol[RIGHT][0] is really
>> just an
>>> > arbitrary solution, isn't it?
>>
>>> True, but this seems no worse than line 81 where ts[0] is returned.
>> Not that
>>> this is a good excuse...
>>
>> Right, but what really bothers me is that you're then using
>> sol[RIGHT][0] as though it means something. So what this function seems
>> to do (suppose ax=X_AXIS) is to take an arbitrary point where the curve
>> intersects x=r and an arbitrary point where the curve intersects x=l and
>> then finds the maximum y value of the curve between those two points.
>
> True.
> A well-formed slur should never retrograde along the X-axis, and thus, the 
> size of sol[LEFT] and sol[RIGHT] should be 1 after filtering out all values 
> less than 0 and greater than 1.
> I think that the programming errors in the current patch should do the trick.

Is it so difficult to just make the solution general? Assuming axis is
Y_AXIS and d is UP, the maximum must appear either at a critical point
of the y-axis polynomial or when the x-axis polynomial is equal to
either l or r. You can filter the critical points to make sure the x
coordinate is within the correct interval, and then filter everything
to make sure that the parameter is between 0 and 1. You'll have no
more than 8 points left and you take the one with the largest Y
coordinate.

I realize that it's unlikely to trigger, at least in the way that
Lilypond currently uses this code, but I do feel that code in a file
called bezier.cc should work for bezier curves in general.

Cheers,
Joe



reply via email to

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