summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grapher/Layouts/LayoutBase.cs2
-rw-r--r--grapher/Layouts/MotivityLayout.cs2
-rw-r--r--grapher/Models/Calculations/AccelCalculator.cs62
-rw-r--r--grapher/Models/Calculations/AccelChartData.cs24
-rw-r--r--grapher/ReadMe/Guide.md9
5 files changed, 78 insertions, 21 deletions
diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs
index b89e2f7..04f5189 100644
--- a/grapher/Layouts/LayoutBase.cs
+++ b/grapher/Layouts/LayoutBase.cs
@@ -10,7 +10,7 @@ namespace grapher.Layouts
public const string Exponent = "Exponent";
public const string Limit = "Limit";
public const string Midpoint = "Midpoint";
- public const string Motility = "Motility";
+ public const string Motivity = "Motivity";
public const string Offset = "Offset";
public const string Cap = "Cap";
public const string Weight = "Weight";
diff --git a/grapher/Layouts/MotivityLayout.cs b/grapher/Layouts/MotivityLayout.cs
index dfef2de..c555ef0 100644
--- a/grapher/Layouts/MotivityLayout.cs
+++ b/grapher/Layouts/MotivityLayout.cs
@@ -20,7 +20,7 @@ namespace grapher.Layouts
CapLayout = new OptionLayout(false, string.Empty);
WeightLayout = new OptionLayout(true, Weight);
OffsetLayout = new OptionLayout(false, string.Empty);
- LimExpLayout = new OptionLayout(true, Motility);
+ LimExpLayout = new OptionLayout(true, Motivity);
MidpointLayout = new OptionLayout(true, Midpoint);
}
}
diff --git a/grapher/Models/Calculations/AccelCalculator.cs b/grapher/Models/Calculations/AccelCalculator.cs
index f2a6c7c..5d3582c 100644
--- a/grapher/Models/Calculations/AccelCalculator.cs
+++ b/grapher/Models/Calculations/AccelCalculator.cs
@@ -67,6 +67,10 @@ namespace grapher.Models.Calculations
double maxSlope = 0.0;
double minSlope = Double.MaxValue;
+ double log = -2;
+ int index = 0;
+ int logIndex = 0;
+
foreach (var magnitudeDatum in magnitudeData)
{
if (magnitudeDatum.magnitude <=0)
@@ -77,6 +81,22 @@ namespace grapher.Models.Calculations
var output = accel.Accelerate(magnitudeDatum.x, magnitudeDatum.y, MeasurementTime);
var outMagnitude = Magnitude(output.Item1, output.Item2);
+ if (!data.VelocityPoints.ContainsKey(magnitudeDatum.magnitude))
+ {
+ data.VelocityPoints.Add(magnitudeDatum.magnitude, outMagnitude);
+ }
+ else
+ {
+ continue;
+ }
+
+ while (Math.Pow(10,log) < outMagnitude)
+ {
+ data.LogToIndex[logIndex] = index;
+ log += 0.01;
+ logIndex++;
+ }
+
var ratio = magnitudeDatum.magnitude > 0 ? outMagnitude / magnitudeDatum.magnitude : starter;
if (ratio > maxRatio)
@@ -108,11 +128,6 @@ namespace grapher.Models.Calculations
data.AccelPoints.Add(magnitudeDatum.magnitude, ratio);
}
- if (!data.VelocityPoints.ContainsKey(magnitudeDatum.magnitude))
- {
- data.VelocityPoints.Add(magnitudeDatum.magnitude, outMagnitude);
- }
-
if (!data.GainPoints.ContainsKey(magnitudeDatum.magnitude))
{
data.GainPoints.Add(magnitudeDatum.magnitude, slope);
@@ -120,9 +135,18 @@ namespace grapher.Models.Calculations
lastInputMagnitude = magnitudeDatum.magnitude;
lastOutputMagnitude = outMagnitude;
+ index += 1;
+ }
+
+ index--;
+
+ while (log <= 4.0)
+ {
+ data.LogToIndex[logIndex] = index;
+ log += 0.01;
+ logIndex++;
}
- data.OrderedVelocityPointsList.AddRange(data.VelocityPoints.Values.ToList());
data.MaxAccel = maxRatio;
data.MinAccel = minRatio;
data.MaxGain = maxSlope;
@@ -143,6 +167,10 @@ namespace grapher.Models.Calculations
Sensitivity = GetSens(ref settings);
+ double log = -2;
+ int index = 0;
+ int logIndex = 0;
+
foreach (var magnitudeDatum in magnitudeData)
{
var output = accel.Accelerate(magnitudeDatum.x, magnitudeDatum.y, MeasurementTime);
@@ -155,6 +183,17 @@ namespace grapher.Models.Calculations
{
data.Combined.VelocityPoints.Add(magnitudeDatum.magnitude, magnitudeWithoutSens);
}
+ else
+ {
+ continue;
+ }
+
+ while (Math.Pow(10,log) < magnitudeWithoutSens)
+ {
+ data.Combined.LogToIndex[logIndex] = index;
+ log += 0.01;
+ logIndex++;
+ }
var xRatio = settings.sensitivity.x * ratio;
var yRatio = settings.sensitivity.y * ratio;
@@ -241,9 +280,18 @@ namespace grapher.Models.Calculations
lastInputMagnitude = magnitudeDatum.magnitude;
lastOutputMagnitudeX = xOut;
lastOutputMagnitudeY = yOut;
+ index += 1;
+ }
+
+ index--;
+
+ while (log <= 4.0)
+ {
+ data.Combined.LogToIndex[logIndex] = index;
+ log += 0.01;
+ logIndex++;
}
- data.Combined.OrderedVelocityPointsList.AddRange(data.Combined.VelocityPoints.Values.ToList());
data.Combined.MaxAccel = maxRatio;
data.Combined.MinAccel = minRatio;
data.Combined.MaxGain = maxSlope;
diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs
index 54685a2..98d501b 100644
--- a/grapher/Models/Calculations/AccelChartData.cs
+++ b/grapher/Models/Calculations/AccelChartData.cs
@@ -13,8 +13,8 @@ namespace grapher.Models.Calculations
AccelPoints = new SortedDictionary<double, double>();
VelocityPoints = new SortedDictionary<double, double>();
GainPoints = new SortedDictionary<double, double>();
- OrderedVelocityPointsList = new List<double>();
OutVelocityToPoints = new Dictionary<double, (double, double, double)>();
+ LogToIndex = new int[601];
}
#endregion Constructors
@@ -35,7 +35,7 @@ namespace grapher.Models.Calculations
public SortedDictionary<double, double> GainPoints { get; }
- public List<double> OrderedVelocityPointsList { get; }
+ public int[] LogToIndex { get; }
public Dictionary<double, (double, double, double)> OutVelocityToPoints { get; }
@@ -48,8 +48,8 @@ namespace grapher.Models.Calculations
AccelPoints.Clear();
VelocityPoints.Clear();
GainPoints.Clear();
- OrderedVelocityPointsList.Clear();
OutVelocityToPoints.Clear();
+ Array.Clear(LogToIndex, 0, LogToIndex.Length);
}
public (double, double, double) FindPointValuesFromOut(double outVelocityValue)
@@ -80,15 +80,21 @@ namespace grapher.Models.Calculations
public int GetVelocityIndex(double outVelocityValue)
{
- var velIdx = OrderedVelocityPointsList.BinarySearch(outVelocityValue);
-
- if (velIdx < 0)
+ var log = Math.Log10(outVelocityValue);
+ if (log < -2)
+ {
+ log = -2;
+ }
+ else if (log > 4)
+ {
+ log = 4;
+ }
+ else
{
- velIdx = ~velIdx;
+ log = log * 100 + 200;
}
- velIdx = Math.Min(velIdx, VelocityPoints.Count - 1);
- velIdx = Math.Max(velIdx, 0);
+ var velIdx = LogToIndex[(int)log];
return velIdx;
}
diff --git a/grapher/ReadMe/Guide.md b/grapher/ReadMe/Guide.md
index 3680c0a..1eae47e 100644
--- a/grapher/ReadMe/Guide.md
+++ b/grapher/ReadMe/Guide.md
@@ -1,7 +1,7 @@
# Raw Accel Guide
## Philosophy
-The Raw Accel driver and GUI's workings and exposed parameters are based on our understanding of mouse acceleration. Our understanding includes the concepts of "gain", "whole vs by component", and "anisotropy." For clarity, we will outline this understanding here.
+The Raw Accel driver and GUI's workings and exposed parameters are based on our understanding of mouse acceleration. Our understanding includes the concepts of "gain", "whole vs by component", and "anisotropy." For clarity, we will outline this understanding here. Those uninterested can skip to Features below.
### Measurements from Input Speed
Raw Accel, like any mouse modification program, works by acting on a passed in (x,y) input and passing back out an (x,y) output. The GUI program creates charts by feeding a set of (x,y) inputs to the driver code to receive a set of (x,y) outputs. The following measurements, available as charts in Raw Accel, are then found from the outputs:
@@ -57,6 +57,9 @@ See "Horizontal and Vertical" in the philosophy section to understand what these
### Last Mouse Move
The Raw Accel GUI reads the output of the raw input stream, and thus the output of the Raw Accel Driver, and displays on the graphs red points corresponding to the last mouse movements. These calculations are slightly slow but build up a cache, so shaking your mouse around on GUI start should make the points display fast and smoothly. This feature can be turned off in the "Charts" menu.
+### Scale by DPI and Poll Rate
+This option does not scale your acceleration curve in any way. Rather, it scales the set of points used to graph your curve, and shows you a window of input speed relevant for your chosen DPI and Poll Rate.
+
## Acceleration Styles
[To be added: pictures of the styles, typical settings]
@@ -72,8 +75,8 @@ This is the style found in CS:GO and Source Engine games. The user can set a rat
### Natural & NaturalGain
Natural is a style found in the game Diabotical. It features a concave curve which starts at 1 and approaches some maximum sensitivity. This style is unique and useful but causes an ugly dip in the gain graph. For this reason we have created the NaturalGain style, which recreates the Natural style shape in the gain graph without any dips. We recommend users use the NaturalGain style instead of the Natural style; on switch some small tweaks may be needed since for any particular settings the NaturalGain is slightly slower to ramp up than the Natural style. NaturalGain is another excellent choice for new users.
-### SigmoidGain
-A sigmoid curve is an s-shaped curve. SigmoidGain creates an s-shaped curve from 1 to some maximum gain in the gain graph, allowing a user to set the maximum gain, the midpoint of the s, and how fast the s ramps up (similarly to the Natural styles.) At one point there was a Sigmoid style but we removed it because it caused an awful dip in the gain graph.
+### Motivity
+This curve looks like an "S" with the top half bigger than the bottom. Mathematically it's a "Sigmoid function on a log-log plot". A user can set the "midpoint" of the S, the "acceleration" (i.e. slantedness) of the S, and the "motivity". "Motivity" sets min and max sensitivity, where the maximum is just "motility", and the minimum is "1/motility." (Sensitivity is 1 at the midpoint.) This curve is calculated and stored in a lookup table before applying acceleration, which makes the gain graph look a little funny. This is one author's favorite curve, and an excellent choice for power users and new users who don't mind playing with the settings a little.
### Logarithm
[Sidiouth needs to write this]