[chronojump] Implemented Samozino jump weight profile
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Implemented Samozino jump weight profile
- Date: Tue, 7 Jan 2020 16:36:14 +0000 (UTC)
commit ca2752eb3ad9cf7ce5d3ed4f72b33bdf62342ee0
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jan 7 17:36:09 2020 +0100
Implemented Samozino jump weight profile
src/gui/cairo/jumpsDjOptimalFall.cs | 6 ++++--
src/gui/cairo/jumpsWeightFVProfile.cs | 14 +++++++++-----
src/gui/cairo/xy.cs | 15 +++++++++------
src/jumpsWeightFVProfile.cs | 10 +++++++---
4 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index 1aaef30c..0d1feb85 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -36,7 +36,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
initGraph();
g.SetFontSize(16);
- printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, "Need to
execute jumps: " + jumpType, g, true);
+ printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
+ string.Format("Need to execute jumps: {0}.", jumpType), g, true);
endGraph();
}
@@ -60,7 +61,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
this.jumpType = jumpType;
this.date = date;
- axisRightLabel = "Fall (cm)";
+ axisYLabel = "Height (cm)";
+ axisXLabel = "Fall (cm)";
}
public override void Do()
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index e80f9682..895b1e7d 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -28,7 +28,7 @@ using Cairo;
public class JumpsWeightFVProfileGraph : CairoXY
{
- public enum ErrorAtStart { NEEDPERSONLEGPARAMS, NEEDJUMPS }
+ public enum ErrorAtStart { NEEDLEGPARAMS, BADLEGPARAMS, NEEDJUMPS }
//constructor when there are no points
public JumpsWeightFVProfileGraph (DrawingArea area, ErrorAtStart error)//, string title, string
jumpType, string date)
@@ -38,10 +38,12 @@ public class JumpsWeightFVProfileGraph : CairoXY
initGraph();
string message = "";
- if(error == ErrorAtStart.NEEDPERSONLEGPARAMS)
- message = "Need to fill person's leg parameters";
+ if(error == ErrorAtStart.NEEDLEGPARAMS)
+ message = "Need to fill person's leg parameters.";
+ else if(error == ErrorAtStart.BADLEGPARAMS)
+ message = "Person's leg parameters are incorrect.";
else //if(error == ErrorAtStart.NEEDJUMPS)
- message = "Need to execute jumps SJl and/or SJ";
+ message = "Need to execute jumps SJl and/or SJ.";
g.SetFontSize(16);
printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight, message, g,
true);
@@ -71,7 +73,9 @@ public class JumpsWeightFVProfileGraph : CairoXY
//this.jumpType = jumpType;
this.date = date;
- axisRightLabel = "Speed (m/s)";
+ outerMargins = 50; //blank space outside the axis
+ axisYLabel = "Force (N)";
+ axisXLabel = "Speed (m/s)";
}
public override void Do()
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 75df46fd..9bf564aa 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -39,7 +39,8 @@ public abstract class CairoXY
protected Cairo.Context g;
protected const int textHeight = 12;
- protected string axisRightLabel = "";
+ protected string axisYLabel = "";
+ protected string axisXLabel = "";
double minX = 1000000;
double maxX = 0;
@@ -54,14 +55,16 @@ public abstract class CairoXY
Cairo.Color blue;
//for all 4 sides
- const int outerMargins = 30; //blank space outside the axis
- const int innerMargins = 30; //space between the axis and the real coordinates
- const int totalMargins = outerMargins + innerMargins;
+ protected int outerMargins = 30; //blank space outside the axis
+ int innerMargins = 30; //space between the axis and the real coordinates
+ int totalMargins;
public abstract void Do();
protected void initGraph()
{
+ totalMargins = outerMargins + innerMargins;
+
//1 create context
g = Gdk.CairoHelper.Create (area.GdkWindow);
@@ -138,8 +141,8 @@ public abstract class CairoXY
g.LineTo(outerMargins, graphHeight - outerMargins);
g.LineTo(graphWidth - outerMargins, graphHeight - outerMargins);
g.Stroke ();
- printText(2, Convert.ToInt32(outerMargins/2), 0, textHeight, "Height (cm)", g, false);
- printText(graphWidth - Convert.ToInt32(outerMargins/2), graphHeight - outerMargins, 0,
textHeight, axisRightLabel, g, false);
+ printText(2, Convert.ToInt32(outerMargins/2), 0, textHeight, axisYLabel, g, false);
+ printText(graphWidth - Convert.ToInt32(outerMargins/2), graphHeight - outerMargins, 0,
textHeight, axisXLabel, g, false);
paintGrid (minX, absoluteMaxX, minY, absoluteMaxY, 5);
}
diff --git a/src/jumpsWeightFVProfile.cs b/src/jumpsWeightFVProfile.cs
index f815a069..f2cd5353 100644
--- a/src/jumpsWeightFVProfile.cs
+++ b/src/jumpsWeightFVProfile.cs
@@ -31,13 +31,12 @@ public class JumpsWeightFVProfile
{
}
- public void Calculate (int personID, int sessionID) //, string jumpType)
+ public void Calculate (int personID, int sessionID, double personWeight, double trochanterToe, double
trochanterFloorOnFlexion)
{
//1 get data
List<Jump> jump_l = SqliteJump.SelectJumpsWeightFVProfile (personID, sessionID, false);
//TODO:true);
//2 convert to list of Point
- //List<Point> point_l = new List<Point>();
point_l = new List<Point>();
foreach(Jump j in jump_l)
{
@@ -49,9 +48,14 @@ public class JumpsWeightFVProfile
LogB.Information("Added point: {0}", j.ToString());
LogB.Information("with weight: {0}", j.Weight.ToString());
*/
+ //Samozino formula is F = m*g*( (h/hp0) +1)
+ //h is jump's height
+ //hp0 = trochanterToe - trochanterFloorOnFlexion
+ double force = (personWeight + j.Weight) * 9.81 * ( (
Util.GetHeightInCentimeters(j.Tv) / (trochanterToe - trochanterFloorOnFlexion) ) + 1 );
+
point_l.Add(new Point(
Util.GetInitialSpeed(j.Tv, true), //TODO: pass
preferences.metersSecondsPreferred and show it on graph label
- Util.GetHeightInCentimeters(j.Tv)
+ force
));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]