[MPlayer-dev-eng] [PATCH] GUI: Implement a true rotary potmeter

Ingo Brückl ib at wupperonline.de
Tue Apr 8 02:25:37 CEST 2014


Hans-Dieter Kosch wrote on Tue, 08 Apr 2014 01:56:39 +0200:

> Ingo Brückl wrote:

>> Hans-Dieter Kosch wrote on Mon, 07 Apr 2014 03:27:22 +0200:

>>> The special case 'x0 == x1 && y0 == y1' to determine if 'zeropoint' and
>>> 'stop' are the same seems not needed. There are more cases where this
>>> happens: x0 == 0 and x1 == 0 and y0 and y1 are in the same quadrant or
>>> vice versa.
>>> So, simply calculate 'stop' and apply it.

>> Well, I did so at first, but I got a difference of something like 9E-17
>> after calculation for two same points. (Must have been late in the night
>> when I simply chose the current solution, but I should have investigated.)

> I see, floating point precision issue.

Yes, but why is it if x0,y0 == x1,y1?

  item->zeropoint = appRadian(item, x0, y0);
  item->arclength = appRadian(item, x1, y1) - item->zeropoint;

results in item->arclength not being zero (for the same call with same
arguments)? I could understand for *different* points lying on the same axis,
but for identical points?

> So, leave that trap and add traps for the cases where the points lie on the
> x/y axis. On the other hand, has such an inaccuracy a practical impact?

Yes, we have to know if there is a potmeter without gap, because
item->arclength should be 2*pi then and not 9E-17 or such.

Ingo


More information about the MPlayer-dev-eng mailing list