diff options
| author | Jacob Palecki <[email protected]> | 2021-01-20 18:25:31 -0800 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2021-01-20 18:25:31 -0800 |
| commit | 6046120f67327411eafa9c6a9fa0601c2ea5c554 (patch) | |
| tree | 47723f0b6f0f0ffe32859133d1384b67dbbcb32d | |
| parent | Update guide for anisotropy options (diff) | |
| download | rawaccel-6046120f67327411eafa9c6a9fa0601c2ea5c554.tar.xz rawaccel-6046120f67327411eafa9c6a9fa0601c2ea5c554.zip | |
Tweaks
| -rw-r--r-- | doc/Guide.md | 8 | ||||
| -rw-r--r-- | doc/images/anisotropy_example.png | bin | 62973 -> 62022 bytes | |||
| -rw-r--r-- | grapher/Constants/Constants.cs | 2 | ||||
| -rw-r--r-- | grapher/Form1.Designer.cs | 9 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 1 | ||||
| -rw-r--r-- | grapher/Models/Calculations/AccelCalculator.cs | 38 |
6 files changed, 27 insertions, 31 deletions
diff --git a/doc/Guide.md b/doc/Guide.md index 421e482..df43e94 100644 --- a/doc/Guide.md +++ b/doc/Guide.md @@ -56,9 +56,9 @@ There are anisotropic settings for whole mode. - **Domain**. This scales the domain of curve around 0 for the horizontal or vertical direction. - If a given curve has an offset at 5 count/ms and a cap that is hit at 15 counts/ms, then a domain_y of 2 would mean that vertical movements hit the offset at 2.5 counts/ms and the cap at 7.5 counts/ms instead. - **Lp Norm**. The distance calculation can be generalized to ((in_x)^p + (in_y)^p)^(1/p)), bringing the calculation into [Lp space](https://en.wikipedia.org/wiki/Lp_space). - - p = 2 is then the "real world" value, yielding the pythagorean theorem as the distance calculation. - - Increasing p makes distances for diagonal movements (where in_x and in_y are close) smaller, and increases the dominance of the larger of the two in determining the distance. - - We recommend almost everyone leave this at 2. + - p = 2 is then the "real world" value, yielding the pythagorean theorem as the distance calculation. + - Increasing p makes distances for diagonal movements (where in_x and in_y are close) smaller, and increases the dominance of the larger of the two in determining the distance. + - We recommend almost everyone leave this at 2.  @@ -68,7 +68,7 @@ With all anisotropic settings considered, the full formula looks like: This can be more easily understood as - (out_x, out_y) = (in_x\*sens_x, in_y\*sens_y) \* ((f( domain-weighted lp-space speed) - 1) \* (directional weight) + 1), where f(v) is our sensitivity function -This formula gaurantees the the smooth transition from the horizontal to vertical curve and vice versa as the user moves their hand diagonally. +This formula gaurantees the smooth transition from the horizontal to vertical curve and vice versa as the user moves their hand diagonally. #### ***By Component*** In this case, the horizontal components are separated and each is given as input to the sensitivity calculation to multiplied by itself before being recombined at output. diff --git a/doc/images/anisotropy_example.png b/doc/images/anisotropy_example.png Binary files differindex e8b9899..6425e68 100644 --- a/doc/images/anisotropy_example.png +++ b/doc/images/anisotropy_example.png diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs index e31f62c..f05be34 100644 --- a/grapher/Constants/Constants.cs +++ b/grapher/Constants/Constants.cs @@ -14,7 +14,7 @@ namespace grapher public const int DefaultPollRate = 1000; /// <summary> Resolution of chart calulation. </summary> - public const int Resolution = 100; + public const int Resolution = 500; /// <summary> Multiplied by DPI over poll rate to find rough max expected velocity. </summary> public const double MaxMultiplier = .05; diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index 13aefb7..20af913 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -1237,15 +1237,6 @@ namespace grapher this.AutoWriteMenuItem.Size = new System.Drawing.Size(210, 22); this.AutoWriteMenuItem.Text = "Apply Settings On Startup"; // - // AutoWriteMenuItem - // - this.AutoWriteMenuItem.Checked = true; - this.AutoWriteMenuItem.CheckOnClick = true; - this.AutoWriteMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.AutoWriteMenuItem.Name = "AutoWriteMenuItem"; - this.AutoWriteMenuItem.Size = new System.Drawing.Size(210, 22); - this.AutoWriteMenuItem.Text = "Apply Settings On Startup"; - // // UseSpecificDeviceMenuItem // this.UseSpecificDeviceMenuItem.Name = "UseSpecificDeviceMenuItem"; diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 9ca1578..6a4c46f 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -406,7 +406,6 @@ namespace grapher.Models var mouseWatcher = new MouseWatcher(form, mouseLabel, accelCharts, settings); - return new AccelGUI( form, accelCalculator, diff --git a/grapher/Models/Calculations/AccelCalculator.cs b/grapher/Models/Calculations/AccelCalculator.cs index 3787291..42b7347 100644 --- a/grapher/Models/Calculations/AccelCalculator.cs +++ b/grapher/Models/Calculations/AccelCalculator.cs @@ -58,7 +58,7 @@ namespace grapher.Models.Calculations private double MaxVelocity { get; set; } - private int Increment { get; set; } + private double Increment { get; set; } private double MeasurementTime { get; set; } @@ -324,14 +324,16 @@ namespace grapher.Models.Calculations } - for (int i = 5; i < MaxVelocity; i+=Increment) + for (double i = 5; i < MaxVelocity; i+=Increment) { SimulatedMouseInput mouseInputData; - mouseInputData.x = i; - mouseInputData.y = i; - mouseInputData.time = MeasurementTime; - mouseInputData.velocity = Velocity(i, i, mouseInputData.time); - mouseInputData.angle = Math.Atan2(i,i); + var ceil = (int)Math.Ceiling(i); + var timeFactor = ceil / i; + mouseInputData.x = ceil; + mouseInputData.y = 0; + mouseInputData.time = MeasurementTime * timeFactor; + mouseInputData.velocity = Velocity(ceil, 0, mouseInputData.time); + mouseInputData.angle = Math.Atan2(ceil, 0); magnitudes.Add(mouseInputData); } @@ -357,13 +359,15 @@ namespace grapher.Models.Calculations magnitudes.Add(mouseInputData); } - for (int i = 5; i < MaxVelocity; i+=Increment) + for (double i = 5; i < MaxVelocity; i+=Increment) { SimulatedMouseInput mouseInputData; - mouseInputData.x = i; + var ceil = (int)Math.Ceiling(i); + var timeFactor = ceil / i; + mouseInputData.x = ceil; mouseInputData.y = 0; - mouseInputData.time = MeasurementTime; - mouseInputData.velocity = Velocity(i, 0, mouseInputData.time); + mouseInputData.time = MeasurementTime*timeFactor; + mouseInputData.velocity = Velocity(ceil, 0, mouseInputData.time); mouseInputData.angle = 0; magnitudes.Add(mouseInputData); } @@ -388,11 +392,13 @@ namespace grapher.Models.Calculations magnitudes.Add(mouseInputData); } - for (int i = 5; i < MaxVelocity; i+=Increment) + for (double i = 5; i < MaxVelocity; i+=Increment) { SimulatedMouseInput mouseInputData; + var ceil = (int)Math.Ceiling(i); + var timeFactor = ceil / i; mouseInputData.x = 0; - mouseInputData.y = i; + mouseInputData.y = ceil; mouseInputData.time = MeasurementTime; mouseInputData.velocity = Velocity(0, i, mouseInputData.time); mouseInputData.angle = Math.PI / 2; @@ -428,7 +434,7 @@ namespace grapher.Models.Calculations magnitudes.Add(mouseInputData); } - for (int magnitude = 5; magnitude < MaxVelocity; magnitude+=Increment) + for (double magnitude = 5; magnitude < MaxVelocity; magnitude+=Increment) { var slowMoveX = Math.Round(magnitude * Math.Cos(angle), 4); var slowMoveY = Math.Round(magnitude * Math.Sin(angle), 4); @@ -501,8 +507,8 @@ namespace grapher.Models.Calculations { MaxVelocity = DPI.Data * Constants.MaxMultiplier; var ratio = MaxVelocity / Constants.Resolution; - Increment = ratio > 1 ? (int) Math.Floor(ratio) : 1; - MeasurementTime = Increment == 1 ? 1 / ratio : 1; + Increment = ratio; + MeasurementTime = 1; SimulatedInputCombined = GetSimulatedInput(); SimulatedInputX = GetSimulatInputX(); SimulatedInputY = GetSimulatedInputY(); |