[chronojump] Passed mass and angle to RunEncoderSegmentCalcs



commit 4fc80ee0809da84fd9a129c8b3f34bd6b249c28d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 9 12:45:44 2022 +0200

    Passed mass and angle to RunEncoderSegmentCalcs

 src/gui/app1/runEncoder.cs | 12 +++++++++---
 src/runEncoder.cs          | 18 ++++++++++++++++--
 2 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index adc4ee1e6..15b231c80 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -391,7 +391,9 @@ public partial class ChronoJumpWindow
                //to not show old vertical segments info on a capture that maybe cannot be done by lack of 
device
                if(currentRunEncoderExercise != null)
                        reCGSD = new RunEncoderCaptureGetSpeedAndDisplacement(
-                                       currentRunEncoderExercise.SegmentCm, 
currentRunEncoderExercise.SegmentVariableCm);
+                                       currentRunEncoderExercise.SegmentCm, 
currentRunEncoderExercise.SegmentVariableCm,
+                                       currentPersonSession.Weight, //but note if person changes (but graph 
will be hopefully erased), this will change also take care on exports
+                                       currentRunEncoder.Angle);
 
                updateRaceAnalyzerCapturePositionTime(true);
                updateRaceAnalyzerCaptureSpeedTime(true);
@@ -592,7 +594,9 @@ public partial class ChronoJumpWindow
 
                //RunEncoderCaptureGetSpeedAndDisplacement reCGSD = new 
RunEncoderCaptureGetSpeedAndDisplacement();
                reCGSD = new RunEncoderCaptureGetSpeedAndDisplacement(
-                               currentRunEncoderExercise.SegmentCm, 
currentRunEncoderExercise.SegmentVariableCm);
+                               currentRunEncoderExercise.SegmentCm, 
currentRunEncoderExercise.SegmentVariableCm,
+                               currentPersonSession.Weight, //but note if person changes (but graph will be 
hopefully erased), this will change also take care on exports
+                               currentRunEncoder.Angle);
                runEncoderShouldShowCaptureGraphsWithData = true;
 
                runEncoderCaptureThread = new Thread(new ThreadStart(runEncoderCaptureDo));
@@ -1070,7 +1074,9 @@ public partial class ChronoJumpWindow
 
                int count = 0;
                reCGSD = new RunEncoderCaptureGetSpeedAndDisplacement(
-                               currentRunEncoderExercise.SegmentCm, 
currentRunEncoderExercise.SegmentVariableCm);
+                               currentRunEncoderExercise.SegmentCm, 
currentRunEncoderExercise.SegmentVariableCm,
+                               currentPersonSession.Weight, //but note if person changes (but graph will be 
hopefully erased), this will change also take care on exports
+                               currentRunEncoder.Angle);
                runEncoderShouldShowCaptureGraphsWithData = true;
 
                cairoGraphRaceAnalyzer_dt = null;
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 5028ed0b3..5d18f5df5 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -295,13 +295,13 @@ public class RunEncoderCaptureGetSpeedAndDisplacement
        private double runEncoderCaptureSpeedMax;
        private double runEncoderCaptureDistance; //m
 
-       public RunEncoderCaptureGetSpeedAndDisplacement(int segmentCm, List<int> segmentVariableCm)
+       public RunEncoderCaptureGetSpeedAndDisplacement(int segmentCm, List<int> segmentVariableCm, double 
massKg, int angle)
        {
                this.segmentCm = segmentCm;
                this.segmentVariableCm = segmentVariableCm;
                segmentVariableCmDistAccumulated = 0;
 
-               segmentCalcs = new RunEncoderSegmentCalcs ();
+               segmentCalcs = new RunEncoderSegmentCalcs (massKg, angle);
                timePre = 0;
        }
 
@@ -406,6 +406,13 @@ public class RunEncoderCaptureGetSpeedAndDisplacement
    */
 public class RunEncoderSegmentCalcs
 {
+       private const double g = 9.81;
+
+       //passed variables
+       private double massKg;
+       private int angle;
+
+       //calculated list of vars
        private List<double> dist_l;
        private List<double> time_l;
        private List<double> speedCont_l;
@@ -421,6 +428,13 @@ public class RunEncoderSegmentCalcs
 
        public RunEncoderSegmentCalcs ()
        {
+       }
+
+       public RunEncoderSegmentCalcs (double massKg, int angle)
+       {
+               this.massKg = massKg;
+               this.angle = angle;
+
                dist_l = new List<double> ();
                time_l = new List<double> ();
                speedCont_l = new List<double> ();


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