summaryrefslogtreecommitdiff
path: root/grapher/Models/Calculations/AccelChartData.cs
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-20 23:16:15 -0700
committerJacob Palecki <[email protected]>2020-09-20 23:16:15 -0700
commit2a756dfb08b4f8c0870173ad4e0393cdeef33c94 (patch)
tree575d676af12a67db93b7ff7557ac029f27a58b8c /grapher/Models/Calculations/AccelChartData.cs
parentMerge branch 'GUI' into Unsure (diff)
downloadrawaccel-2a756dfb08b4f8c0870173ad4e0393cdeef33c94.tar.xz
rawaccel-2a756dfb08b4f8c0870173ad4e0393cdeef33c94.zip
Attempt to get separate x/y working
Diffstat (limited to 'grapher/Models/Calculations/AccelChartData.cs')
-rw-r--r--grapher/Models/Calculations/AccelChartData.cs24
1 files changed, 18 insertions, 6 deletions
diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs
index 8c0c8ea..c943643 100644
--- a/grapher/Models/Calculations/AccelChartData.cs
+++ b/grapher/Models/Calculations/AccelChartData.cs
@@ -52,12 +52,7 @@ namespace grapher.Models.Calculations
}
else
{
- var velIdx = OrderedVelocityPointsList.BinarySearch(outVelocityValue);
-
- if (velIdx < 0)
- {
- velIdx = ~velIdx;
- }
+ var velIdx = GetVelocityIndex(outVelocityValue);
velIdx = Math.Min(velIdx, VelocityPoints.Count - 1);
values = (VelocityPoints.ElementAt(velIdx).Key, AccelPoints.ElementAt(velIdx).Value, GainPoints.ElementAt(velIdx).Value);
@@ -66,6 +61,23 @@ namespace grapher.Models.Calculations
}
}
+ public (double, double, double) ValuesAtIndex(int index)
+ {
+ return (VelocityPoints.ElementAt(index).Value, AccelPoints.ElementAt(index).Value, GainPoints.ElementAt(index).Value);
+ }
+
+ public int GetVelocityIndex(double outVelocityValue)
+ {
+ var velIdx = OrderedVelocityPointsList.BinarySearch(outVelocityValue);
+
+ if (velIdx < 0)
+ {
+ velIdx = ~velIdx;
+ }
+
+ return velIdx;
+ }
+
#endregion Methods
}
}