blob: a8f3307fab12807e20f60efb3d67207ff87c1f9d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static grapher.AccelCharts;
namespace grapher.Models.Calculations
{
public class AccelData
{
public AccelData()
{
Combined = new AccelChartData();
X = new AccelChartData();
Y = new AccelChartData();
}
public AccelChartData Combined { get; }
public AccelChartData X { get; }
public AccelChartData Y { get; }
public void Clear()
{
Combined.Clear();
X.Clear();
Y.Clear();
}
public void CalculateDots(int x, int y, ref EstimatedPoints estimation)
{
var magnitude = AccelCalculator.Magnitude(x, y);
estimation.CombinedVelocity.Y = magnitude;
estimation.XVelocity.Y = Math.Abs(x);
estimation.YVelocity.Y = Math.Abs(y);
(var inCombVel, var combSens, var combGain) = Combined.FindInValuesFromOut(magnitude);
estimation.CombinedVelocity.X = inCombVel;
estimation.CombinedSensitivity.X = inCombVel;
estimation.CombinedGain.X = inCombVel;
estimation.CombinedSensitivity.Y = combSens;
estimation.CombinedGain.Y = combGain;
(var inXVel, var xSens, var xGain) = X.FindInValuesFromOut(estimation.XVelocity.Y);
estimation.XVelocity.X = inXVel;
estimation.XSensitivity.X = inXVel;
estimation.XGain.X = inXVel;
estimation.XSensitivity.Y = xSens;
estimation.XGain.Y = xGain;
(var inYVel, var ySens, var yGain) = Y.FindInValuesFromOut(estimation.YVelocity.Y);
estimation.YVelocity.X = inYVel;
estimation.YSensitivity.X = inYVel;
estimation.YGain.X = inYVel;
estimation.YSensitivity.Y = ySens;
estimation.YGain.Y = yGain;
}
}
}
|