[chronojump] Improvements on capture curves (C#) to fix 'ec' with small curves in the middle



commit f80759eb7882874782e9130420319f5ee131be7c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 15 17:47:57 2015 +0200

    Improvements on capture curves (C#) to fix 'ec' with small curves in the middle

 encoder/graph.R    |   15 ---------------
 src/encoder.cs     |    2 --
 src/gui/encoder.cs |   13 ++++++++++++-
 3 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 8d1faed..8a972a1 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -320,11 +320,6 @@ findCurvesNew <- function(displacement, eccon, min_height, draw, title)
              count = count +1
        }
        
-       write("stored values (a)", stderr())
-       write(c("-",startStored),stderr())
-       write(c("-",endStored),stderr())
-       write(c("-",startHStored),stderr())
-       
        #if eccon it's 'ec' and last row it's 'e', delete it
        if(row > 1)
        {
@@ -343,11 +338,6 @@ findCurvesNew <- function(displacement, eccon, min_height, draw, title)
                }
        }
 
-       write("stored values (b)", stderr())
-       write(c("-",startStored),stderr())
-       write(c("-",endStored),stderr())
-       write(c("-",startHStored),stderr())
-
        #if eccon == "ec" mix 'e' and 'c' curves
        if(eccon == "ec") {
                startStoredOld = startStored
@@ -368,11 +358,6 @@ findCurvesNew <- function(displacement, eccon, min_height, draw, title)
                }
        }
 
-       write("stored values (c)", stderr())
-       write(c("-",startStored),stderr())
-       write(c("-",endStored),stderr())
-       write(c("-",startHStored),stderr())
-       
        if(draw) {
                lty=1
                col="black"
diff --git a/src/encoder.cs b/src/encoder.cs
index 415e2aa..286a4b3 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -848,12 +848,10 @@ public class EncoderCaptureCurve {
 
 public class EncoderCaptureCurveArray {
        public ArrayList ecc;   //each of the EncoderCaptureCurve
-       public int curvesDone;  //starts at int 0. How many ecc have been calculated by R
        public int curvesAccepted; //starts at int 0. How many ecc have been accepted (will be rows in 
treeview_encoder_capture_curves)
        
        public EncoderCaptureCurveArray() {
                ecc = new ArrayList();
-               curvesDone = 0;
                curvesAccepted = 0;
        }
        
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 1b900db..d72bb06 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2084,6 +2084,9 @@ public partial class ChronoJumpWindow
                //going down on inertial, going up in ec, ecs
                bool capturingFirstPhase = true; 
 
+               //just a default value, unused until a curve has been accepted
+               bool lastDirectionStoredIsUp = true;
+
 
                //create ecca if needed
                if(! eccaCreated) {
@@ -2312,6 +2315,8 @@ public partial class ChronoJumpWindow
                                                         */
 
                                                        //3) if it's ecc-con, don't record first curve if 
first curve is concentric
+                                                       //
+                                                       //4) on ec, ecS don't have store two curves in the 
same direction
 
                                                        /*
                                                         * on inertiaMomentCalculation we don't need to send 
data to R and get curves
@@ -2330,6 +2335,11 @@ public partial class ChronoJumpWindow
                                                                                        sendCurve = false;
                                                                                if( (eccon == "ec" || eccon 
== "ecS") && ecc.up && capturingFirstPhase ) //3
                                                                                        sendCurve = false;
+                                                                               if( 
+                                                                                               (eccon == 
"ec" || eccon == "ecS") && 
+                                                                                               
ecca.curvesAccepted > 0 &&
+                                                                                               
lastDirectionStoredIsUp == ecc.up ) //4
+                                                                                       sendCurve = false;
                                                                        }
                                                                        capturingFirstPhase = false;
                                                                } else {
@@ -2342,9 +2352,10 @@ public partial class ChronoJumpWindow
                                                                                        
UtilEncoder.CompressData(curve, 25)     //compressed
                                                                                        );
 
-                                                                       ecca.curvesDone ++;
                                                                        ecca.curvesAccepted ++;
                                                                        ecca.ecc.Add(ecc);
+
+                                                                       lastDirectionStoredIsUp = ecc.up;
                                                                }
                                                        }
                                                }


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