math - Looks like a simple graphing problem -


Currently I have a control on which I need to add the convenience of applying various intensities (or sensitivity). The problem is best explained in the form of an image:

As you can see, I have an X and Y axis, both of which have arbitrary border 100 - this Must be enough for clarification. Currently, my control is the red line (linear behavior), but I have other 3 curves (or more) would add capacity, ie if any control over sensitive will ignore a setting linear setting and starting point is always a three rows 0, and the end point will always be 100.

I know that an exponent is very high, but can not seem to understand it in a way forward. Any suggestions please?

The time you have illustrated looks like a curve, the idea is that the minimum and maximum The border stays the same as the input, but the middle is in your graph as you can (which I can note the not circular arch that you get from the cosine implementation.)

< P> Graphically, it looks like this:

Therefore, with that motivation, here's the math ...

If you have a If the values ​​range from 0 to 1, then the function is simple:

  y = f (x, gamma) = x ^ gamma   x = x (x / xmax) = x (x, gmma) = (x / xmax) ^ gamma) * xmax  

or alternatively:

  y = f (x, gamma) = (x ^ gamma) / (xmax ^ (gamma - 1))  

If you want to add a non-zero Aksmin you one step ahead Can increase.

When the gamma is 1, the line is always completely linear (y = x). If x is less than 1, then your curve bends upwards. If x is greater than 1, then your curve bends downward. The mutual value of gamma will change the value back to the original (x = f (y, 1 / g) = f (f (x, g), 1 / g).

Just adjust the value of your own Gama's according to the tastes and requirements of the application. Since you want to give the user several options for "sensitivity enhancement", you may want to give your users the choice of linear scale -4 (at least sensitive) 0 ( No change) 4 (most conservative) In other words, (-4, -3, -2, -1, 0, 1, 2, 3, 4), but (5.06, 3.38, 2.25, 1.50, 1.00, 0.67, 0.44, is translated into Gamma values ​​of 0.30, 0.20).

the coding might look something like this in C # public class Snvednshiltaadytnkrta (public) sensitivity Adjustment () {} Public Sensitivity Adjuster (Int Level) {Setcentivity Level (Level);} Private Double _ G = 1.0; public void Setsensitiviti level (brick-level) {_Gamma = Mtkpo (1.5 lev el);} adjust public Double (double x) {return (Math. Po ((x / 100), _Gamma) * 100); }}

To use it, create a new sensitivity adjustment, set sensitivity level according to user preferences (using constructor or method, and -4 to 4 maybe a reasonable level value ) And call adjusted (x) to get the adjusted output value. If you want a wide or narrow range of reasonable levels, you will increase or decrease the value of the SetSensitivityLevels method 1.5. And of course, 100 represents your maximum X value.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -