On Aug 23, 2011, at 6:55 AM, joenee...@gmail.com 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.

> But there's no guarantee that that maximum is what you're after.

I'm pretty sure that, in the case of a well-formed slur, the Y maximum or 
minimum is what I'm after.

> For example, if the curve intersects x=r before it intersects x=l then it
> seems to me that Polynomial::minmax will return something weird.

This is true - I've put a programming error in polynomial.cc for this case.

> And if there are multiple intersections with either line, there are a lot of
> different answers that could come out.

True.  In the case of slurs, this should not happen.  The patch passes the 
regtests without ever triggering this warning (it'd be difficult to trigger it, 
as you'd have to make the slur run backwards).

Cheers,
MS
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to