[chronojump] Better method for: sprint.IsDataOk, includes now firs track



commit 0b9bcb8acde179a7a717fc446a2057b741e41ea9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Feb 21 12:23:10 2022 +0100

    Better method for: sprint.IsDataOk, includes now firs track

 src/sprint.cs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/sprint.cs b/src/sprint.cs
index 6a3d62b2e..d895c59b9 100644
--- a/src/sprint.cs
+++ b/src/sprint.cs
@@ -194,10 +194,16 @@ public class SprintRGraph
                List<double> positionsL = positionsAsDoubleL();
                List<double> splitTimesL = splitTimesAsDoubleL();
 
-               //start with 1 because at 0 is the first contact
+               double speed = 0;
+               if(positionsL.Count > 0 && splitTimesL.Count > 0)
+               {
+                       speed = positionsL[0] / (1.0 * splitTimesL[0]);
+                       speedsL.Add(speed);
+               }
+
                for(int i = 1; i < positionsL.Count ; i ++)
                {
-                       double speed = 1.0 * (positionsL[i] - positionsL[i-1]) /
+                               speed = 1.0 * (positionsL[i] - positionsL[i-1]) /
                                (1.0 * (splitTimesL[i] - splitTimesL[i-1]));
                        speedsL.Add(speed);
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]