octave-maintainers
[Top][All Lists]
Advanced

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

Re: Need help for little math problem


From: Michael Goffioul
Subject: Re: Need help for little math problem
Date: Thu, 22 Sep 2011 16:23:22 +0100

On Thu, Sep 22, 2011 at 12:26 PM, Olaf Till <address@hidden> wrote:
> No help with the math problem, but maybe 2 possibilities to solve this
> differently:
>
> 1. Round or reject user input for M and m if M deviates too far from a
> multiple of m (I guess in most useful cases M should be a multiple of
> m anyway),
>
> or
>
> 2. Do the mapping only in direction double -> integer, i.e. map the
> current value from double to integer (by some rounding as hinted by
> you), but preserve both the double and the integer to which it
> maps. If a new integer value comes back from the widget (I don't know
> how), check if it has changed with respect to the old integer
> value. If not, keep the preserved current double value. If yes, change
> the preserved current double value by a multiple of M (or up to max or
> min).
>
> Was just an idea ...

Thanks for the input. I'll read it in details later, but it looks like you're
assuming that value changes in the integer scale are only by M, which
is not the case. Just for completeness, I have to map the floating-point
scale (uicontrol::min, uicontrol::max, uicontrol::sliderstep), to a Qt
QAbstractSlider (http://doc.qt.nokia.com/stable/qabstractslider.html),
that is: minimum, maximum, singleStep, pageStep, and "unity".

Michael.


reply via email to

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