[chronojump] Overloaded GetInitialSpeed string/double



commit 148dfa90a74cc568707257727a123ff0d2de9e77
Author: JordiRodeiro <jordirodeiro gmail com>
Date:   Fri Dec 13 12:48:19 2019 +0100

    Overloaded GetInitialSpeed string/double

 src/util.cs | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/util.cs b/src/util.cs
index 892b78fb..6a5790ad 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -717,11 +717,16 @@ public class Util
 
                return stiffness;
        }
-       
 
-       public static string GetInitialSpeed (string time, bool metersSecondsPreferred) 
+       //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 = Convert.ToDouble( GetHeightInCentimeters(time) );
+               double height = GetHeightInCentimeters(time);
                height = height / 100; //in meters
                
                // Vo = sqrt(2gh)
@@ -730,7 +735,7 @@ public class Util
                if(! metersSecondsPreferred)
                        initialSpeed *= 3.6;
 
-               return initialSpeed.ToString();
+               return initialSpeed;
        }
        
        public static double GetDjPower (double tc, double tf, double mass, double fallHeight) 


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