[chronojump] ForceSensor interpolated path starts at 0N by default



commit 4e914b488b1dbd8277e905548bc8ee553a2986f6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed May 19 12:04:54 2021 +0200

    ForceSensor interpolated path starts at 0N by default

 src/gui/app1/forceSensor.cs | 1 +
 src/utilMath.cs             | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index 8cc342920..095033e72 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -2158,6 +2158,7 @@ LogB.Information(" fs R ");
                        repetitiveConditionsWin.GetForceSensorFeedbackPathMasterSeconds;
 
                InterpolateSignal interpolateS = new InterpolateSignal(
+                               true, //start at 0
                                repetitiveConditionsWin.GetForceSensorFeedbackPathMin,
                                repetitiveConditionsWin.GetForceSensorFeedbackPathMax,
                                maxx * 1000,
diff --git a/src/utilMath.cs b/src/utilMath.cs
index fca801b65..040917c57 100644
--- a/src/utilMath.cs
+++ b/src/utilMath.cs
@@ -398,7 +398,7 @@ public class InterpolateSignal
        {
                this.point_l = point_l;
        }
-       public InterpolateSignal (int minY, int maxY, int maxX, int stepX)
+       public InterpolateSignal (bool startAt0, int minY, int maxY, int maxX, int stepX)
        {
                Random random = new Random();
                this.point_l = new List<PointF>();
@@ -408,7 +408,10 @@ public class InterpolateSignal
 
                for(int i = 0; i < maxX; i += stepX)
                {
-                       point_l.Add(new PointF(i, minY + (random.NextDouble() * range)));
+                       if(startAt0 && i == 0)
+                               point_l.Add(new PointF(i, 0));
+                       else
+                               point_l.Add(new PointF(i, minY + (random.NextDouble() * range)));
 
                        /*
                        PointF p = new PointF(i, minY + (random.NextDouble() * range));


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