just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Revision:
5:73cd58b58f95
Parent:
4:f9d364f10335
Child:
6:444859c27e78
--- a/elasticLoop.cpp	Wed Apr 04 10:05:25 2012 +0000
+++ b/elasticLoop.cpp	Thu Apr 05 12:29:14 2012 +0000
@@ -147,7 +147,52 @@
 
             break;
         case CONTRACT_CENTRAL:
-            sprintf(spotName,"contract_central");
+        sprintf(spotName,"contract");
+
+            //setColor(0x07);//0x04+0x02>>i);
+            setColor(0x04);
+
+            // default (initial) shape:
+            startRadius=100;
+            bluePrint.buildCircularScafold(startRadius,  vector2D(0,0), 20); //(float _radius, vector2D _pos,vector2D _vel, int _numScafoldPoints);
+
+            // Numeric parameters for the simulated mechanical system:
+            massLoopParticle=0.05;
+            dampMotionMassesLoop=0.023;//0.17;
+            massAnchor=0.5;
+            dampMotionAnchorMass=0.01;
+            // Springs:
+            centralSpringK=0.3;
+            centralSpringRelax=startRadius;
+            interSpringK=0.54;//46;
+            interSpringRelax=30;
+            // for "zack-like" blob:
+            interParticleRange=100;
+            factorInterParticleForce=18.0;
+
+            searchActive=false;
+            pseudopodesMode=false; // this is for contour following.
+
+            // Active/Inactive Forces:
+            springForcesOnLoop= true;
+            lightForcesOnLoop= true;
+            forceBorderOnLoop=false;
+            nuclearForceOnLoop=false;//true;
+            interParticleForceOnLoop=false;
+            forceInternalPressureOnLoop=false; // (when true, either constant force or calculated area using Green function or approximation by bounding box)
+            // Recentering vector:
+            angleCorrectionForceLoop=0;// in deg
+            recenteringForceOnLoop=true;
+            angleCorrectionForceNucleus=0;// in deg
+            recenteringForceOnNucleus=false;//true;
+
+            factorLightForce=4.3;//3.0;//8.0;
+            factorRecenteringAnchorMass= 20.0/bluePrint.scafold.size();
+            factorRecenteringLoopMass=0.045;
+            factorPressureLoopMass=1.5;
+            factorForceBorder=150;
+        /*
+            sprintf(spotName,"contract_c");
 
             //setColor(0x07);//0x04+0x02>>i);
             setColor(0x04);
@@ -187,12 +232,13 @@
             recenteringForceOnNucleus=false;//true;
 
             factorLightForce=4.3;//3.0;//8.0;
-            factorRecenteringAnchorMass=20.0/bluePrint.scafold.size();
+            factorRecenteringAnchorMass= 20.0/bluePrint.scafold.size();
             factorRecenteringLoopMass=0.045;
             factorPressureLoopMass=1.5;
             factorForceBorder=150;
-
+*/
             break;
+            
         case CONTOUR_FOLLOWING:
             sprintf(spotName,"following"); //this is a contour-following loop
 
@@ -341,7 +387,7 @@
 
     // per-blob mirror delay (if things were well adjusted - in particular mirror waiting times, then this could be 0. But in case of unique blobs, it may be interesting to accelerate display 
     // AND correct the delay by software):
-    displaySensingBuffer.setDelayMirrors(4); 
+    displaySensingBuffer.setDelayMirrors(0); 
 }
 
 void elasticLoop::initSizeBlob(int _numMasses) {
@@ -367,7 +413,7 @@
     // Initial conditions for the loop masses:
     for (int i = 0; i < numMasses; i++) {
         massesLoop[i].setIntegrationStep(0.23);//18); // VERY IMPORTANT! in the case of verlet integration, we need to set dt BEFORE setting the initial speed.
-        massesLoop[i].setInitialCondition(startCenter, startSpeed); 
+        massesLoop[i].setInitialCondition(startCenter.x+bluePrint.scafold[i].x,startCenter.y+bluePrint.scafold[i].y, startSpeed.x, startSpeed.y); 
         massesLoop[i].mass=massLoopParticle;
         massesLoop[i].dampMotion=dampMotionMassesLoop;
     }