lilypond-devel
[Top][All Lists]

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

 From: joeneeman Subject: Re: Does better polynomial calculations for avoid objects. (issue 4860042) Date: Tue, 23 Aug 2011 04:55:58 +0000

```
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.
But there's no guarantee that that maximum is what you're 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. And if
there are multiple intersections with either line, there are a lot of
different answers that could come out.

http://codereview.appspot.com/4860042/

```