diff options
| author | Jacob Palecki <[email protected]> | 2020-09-20 23:16:15 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-20 23:16:15 -0700 |
| commit | 2a756dfb08b4f8c0870173ad4e0393cdeef33c94 (patch) | |
| tree | 575d676af12a67db93b7ff7557ac029f27a58b8c /grapher/Models/Calculations/AccelChartData.cs | |
| parent | Merge branch 'GUI' into Unsure (diff) | |
| download | rawaccel-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.cs | 24 |
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 } } |