From c5c3c2a8a841d664a422380ab31497b3f741f07f Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 3 Dec 2020 20:01:49 -0500 Subject: filter out abs move raw input --- grapher/Models/Calculations/AccelChartData.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'grapher/Models/Calculations/AccelChartData.cs') diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs index 60d4c89..48374c1 100644 --- a/grapher/Models/Calculations/AccelChartData.cs +++ b/grapher/Models/Calculations/AccelChartData.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; namespace grapher.Models.Calculations @@ -80,6 +81,8 @@ namespace grapher.Models.Calculations public int GetVelocityIndex(double outVelocityValue) { + Debug.Assert(outVelocityValue >= 0); + var log = Math.Log10(outVelocityValue); if (log < -2) { -- cgit v1.2.3 From c221eb3d62ccbd7f2a5203abd3e0eae8e9bf31e8 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 3 Dec 2020 22:42:29 -0500 Subject: add changes from review rename some vars prefer exceptions over assert refactor poll rate field usage in MouseWatcher --- grapher/Models/Calculations/AccelChartData.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'grapher/Models/Calculations/AccelChartData.cs') diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs index 48374c1..71ee927 100644 --- a/grapher/Models/Calculations/AccelChartData.cs +++ b/grapher/Models/Calculations/AccelChartData.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; namespace grapher.Models.Calculations @@ -81,7 +80,10 @@ namespace grapher.Models.Calculations public int GetVelocityIndex(double outVelocityValue) { - Debug.Assert(outVelocityValue >= 0); + if (outVelocityValue < 0) + { + throw new ArgumentException($"invalid velocity: {outVelocityValue}"); + } var log = Math.Log10(outVelocityValue); if (log < -2) -- cgit v1.2.3