Change mouse min max difference calculation into floating point number
I am using this patch that take the mouse x and y cordinstes and post the change in presentage
How this patch can be converted to work with floating points numbers that are between -2. and 2. ?
I don't understand the patch or the question, but in case it helps, here is a straightforward way to scale mouse coordinates to -2., 2. given minimum and maximum mouse coordinates
the patch you posted matches nothing that one can link to your explanation about it.
the patch you posted matches nothing that one can link to your explanation about it.
What do yo mean?
the current patch takes the x y coordinates of the mouse and output the min and max difference when pressing 2.
My wish is to make it works also with floating points number that can be between different range of numbers such as -2. to 2. and 0. to 1. etc
difference between what ?
and what is percentage made from ?
1- I press number 1 - it should be reset
2- I hold key 2 and what then ?
I get 166000 % (hundred sixty six thousand percent) after moving mouse a bit
What should that be ?

Again you don't ask something in understandable way.
if you set a range by whatever action, and then want to express current mouse position within
that range, or compared to that range, and calculated in what way ?
what should -2. ~ 2. represent ?
Where should mouse be to produce output of -1.25
if set range was 220 1456 ?
or asked in a different way, what should output be
if range was 333 1800 and mouse is at 500 ? or 22 ?
difference between what ?
and what is percentage made from ?
Lets put aside the mouse. I'm getting input from sensor that produced floating points numers that between -2 and 2 or -1 and 1.
I want the same system that works very nice with the mouse to be abke to work the same with floating points from senor.
so if I press 1 and the sensor numbers are between -0.5 and 0.5 then I press 2 and the new numbers I get are 0.3 and 0.75 the percentage I should get is 25%
you mean that you get sensors input that can range from -1. ~ 1.
then when you press a key current min and max values are compared to full range.
but 0.3 to 0.75 is only movement distance of 0.4
how can that be 25 % of maximal -1. ~ 1. which makes distance of 2. ?
or if you use that -0.5 ~ 0.5 = max distance 1.
again it does not make 25% because 0.4 is 40% of 1.
you mean that you get sensors input that can range from -1. ~ 1.
yes
then when you press a key current min and max values are compared to full range.
this not must. It cannot compare to the current range of -1 and 1?
but 0.3 to 0.75 is only movement distance of 0.4
how can that be 25 % of maximal -1. ~ 1. which makes distance of 2. ?
Yes, my mistake, my question is how this system can work same as it is working with mouse but with numbers from sensor between -1. and 1.
As explained above.
calculate whatever you want to whatever you want,
I don't understand exactly what it is that you take into account.
also not because input can be within or outside of new set min/max values.