[chronojump] GetInitialSpeed moved from util.cs to jumps.cs



commit 4d07a32853d101a3d28139fc437ea355382713f6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Aug 4 12:37:22 2022 +0200

    GetInitialSpeed moved from util.cs to jumps.cs

 src/exportSession.cs |  6 +++---
 src/jump.cs          | 21 ++++++++++++++++++++-
 src/treeview/jump.cs |  6 +++---
 src/util.cs          | 20 --------------------
 4 files changed, 26 insertions(+), 27 deletions(-)
---
diff --git a/src/exportSession.cs b/src/exportSession.cs
index 9b3cb81ea..ac9a53552 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -373,7 +373,7 @@ public class ExportSession
                                                Util.TrimDecimals(Util.GetHeightInCentimeters(myStr[5]), dec) 
+ ":" +  
                                                Util.TrimDecimals(getPower(tc, tf, personWeight, 
extraWeightInKg, fall), dec) + ":" +
                                                Util.TrimDecimals(Util.GetStiffness(personWeight, 
extraWeightInKg, tf, tc), dec) + ":" +
-                                               Util.TrimDecimals(Util.GetInitialSpeed(myStr[5], 
preferences.metersSecondsPreferred), dec) + ":" +  //true: m/s
+                                               Util.TrimDecimals(Jump.GetInitialSpeed(myStr[5], 
preferences.metersSecondsPreferred), dec) + ":" +  //true: m/s
                                                
Util.TrimDecimals(UtilAll.DivideSafe(Util.GetHeightInMeters(tf), tc), dec) + ":" +
                                                myStr[12] + ":" +       //jump.datetime
                                                Util.RemoveNewLine(myStr[9], true) + ":" +      
//jump.description
@@ -497,13 +497,13 @@ public class ExportSession
                                        Util.TrimDecimals(myStr[6], dec) + ":" +                
//jumpRj.tcMax 
                                        Util.TrimDecimals(myStr[5], dec) + ":" +                //jumpRj.tvMax
                                        Util.TrimDecimals(Util.GetHeightInCentimeters(myStr[5]), dec) + ":" + 
  //Max height
-                                       Util.TrimDecimals(Util.GetInitialSpeed(
+                                       Util.TrimDecimals(Jump.GetInitialSpeed(
                                                        myStr[5], preferences.metersSecondsPreferred), dec) + 
":" +     //Max initial speed (true:m/s)
                                        Util.TrimDecimals(maxRSI, dec) + ":" +
                                        Util.TrimDecimals(myStr[11], dec) + ":" +               //jumpRj.tcAvg
                                        Util.TrimDecimals(myStr[10], dec) + ":" +               //jumpRj.tvAvg
                                        Util.TrimDecimals(Util.GetHeightInCentimeters(myStr[10]), dec) + ":" 
+  //Avg height
-                                       Util.TrimDecimals(Util.GetInitialSpeed(
+                                       Util.TrimDecimals(Jump.GetInitialSpeed(
                                                        myStr[10], preferences.metersSecondsPreferred), dec) 
+ ":" +    //Avg Initial speed (true:m/s)
                                        Util.TrimDecimals(avgRSI, dec) + ":" +
                                        myStr[7] + ":" +                //jumpRj.Fall
diff --git a/src/jump.cs b/src/jump.cs
index fa3def159..f851ffc89 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -96,7 +96,26 @@ public class Jump : Event
        {
                return Util.GetStiffness(personMassInKg, extraMass, tv, tc);
        }       
-       
+
+       //old code sends and returns strings
+       public static string GetInitialSpeed (string time, bool metersSecondsPreferred)
+       {
+               return GetInitialSpeed (Convert.ToDouble (time), metersSecondsPreferred).ToString();
+       }
+       //new code (2019 ...) sends and returns doubles
+       public static double GetInitialSpeed (double time, bool metersSecondsPreferred)
+       {
+               double height = Util.GetHeightInCentimeters (time);
+               height = height / 100; //in meters
+
+               // Vo = sqrt(2gh)
+               double initialSpeed = System.Math.Sqrt ( 2 * 9.81 * height );
+
+               if(! metersSecondsPreferred)
+                       initialSpeed *= 3.6;
+
+               return initialSpeed;
+       }
 
        public override string ToString() {
                return uniqueID + ":" + personID + ":" + sessionID + ":" + type + ":" + tv + ":" + tc + ":" + 
datetime + ":" + description;
diff --git a/src/treeview/jump.cs b/src/treeview/jump.cs
index 0cc2e22f9..a5c454bac 100644
--- a/src/treeview/jump.cs
+++ b/src/treeview/jump.cs
@@ -231,7 +231,7 @@ public class TreeViewJumps : TreeViewEvent
                if (preferences.showStiffness)
                        myData[count++] = newJump.Stiffness(personWeight, weightInKg).ToString();
                if (preferences.showInitialSpeed) 
-                       myData[count++] = Util.TrimDecimals(Util.GetInitialSpeed(newJump.Tv.ToString(), 
preferences.metersSecondsPreferred), pDN);
+                       myData[count++] = Util.TrimDecimals(Jump.GetInitialSpeed(newJump.Tv.ToString(), 
preferences.metersSecondsPreferred), pDN);
                if (preferences.showJumpRSI)
                        myData[count++] = Util.TrimDecimals(newJump.RSI, pDN);
                if (preferences.showAngle) 
@@ -419,7 +419,7 @@ public class TreeViewJumpsRj : TreeViewJumps
                                myData[count++] = ""; 
                }
                if (preferences.showInitialSpeed) 
-                       myData[count++] = Util.TrimDecimals(Util.GetInitialSpeed(
+                       myData[count++] = Util.TrimDecimals(Jump.GetInitialSpeed(
                                                thisTv, preferences.metersSecondsPreferred), pDN);
                if (preferences.showJumpRSI)
                        myData[count++] = Util.TrimDecimals(
@@ -553,7 +553,7 @@ public class TreeViewJumpsRj : TreeViewJumps
                }
                if (preferences.showInitialSpeed) 
                        myData[count++] = Util.TrimDecimals(
-                                       Util.GetInitialSpeed(
+                                       Jump.GetInitialSpeed(
                                                tvAVGDouble.ToString(), preferences.metersSecondsPreferred)
                                        , pDN);
                if (preferences.showJumpRSI)
diff --git a/src/util.cs b/src/util.cs
index 38290f0dd..0cd2772bc 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -799,26 +799,6 @@ public class Util
                return stiffness;
        }
 
-       //old code sends and returns strings
-       public static string GetInitialSpeed (string time, bool metersSecondsPreferred)
-       {
-               return GetInitialSpeed (Convert.ToDouble(time), metersSecondsPreferred).ToString();
-       }
-       //new code (2019 ...) sends and returns doubles
-       public static double GetInitialSpeed (double time, bool metersSecondsPreferred)
-       {
-               double height = GetHeightInCentimeters(time);
-               height = height / 100; //in meters
-               
-               // Vo = sqrt(2gh)
-               double initialSpeed = System.Math.Sqrt ( 2 * 9.81 * height ); 
-
-               if(! metersSecondsPreferred)
-                       initialSpeed *= 3.6;
-
-               return initialSpeed;
-       }
-
        public static double GetAverageImpulsionSpeed(double jumpHeightM)
        {
                return Math.Sqrt( (9.81 * jumpHeightM) / 2);


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