Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
Diff: elasticLoop.cpp
- Revision:
- 40:ee217eff826c
- Parent:
- 32:52273c3291fe
- Child:
- 41:32c80fc09b59
--- a/elasticLoop.cpp Wed Oct 16 15:54:39 2013 +0000 +++ b/elasticLoop.cpp Wed Mar 26 09:52:31 2014 +0000 @@ -279,7 +279,7 @@ // Springs: centralSpringK=0.4; centralSpringRelax=100;//bluePrint.radius; - interSpringK=0.4;//46; + interSpringK=0.43;//46; interSpringRelax=0.7*startRadius*2*sin(1.0* PI/ bluePrint.scafold.size()); // if factor=1, this makes for a perfect polygon at relax for all springs... // for "zack-like" blob: interParticleRange=70; @@ -296,19 +296,19 @@ interParticleForceOnLoop=true; forceInternalPressureOnLoop=false; // (when true, either constant force or calculated area using Green function or approximation by bounding box) // Recentering vector: - angleCorrectionForceLoop=240;//239;// in deg + angleCorrectionForceLoop=236;//239;// in deg recenteringForceOnLoop=true; angleCorrectionForceNucleus=180;// in deg recenteringForceOnNucleus=false;//true; - factorLightForce=2.23;//3.0;//8.0; + factorLightForce=2.4;//3.0;//8.0; factorRecenteringAnchorMass=1.0;//20.0/scafold.size(); factorRecenteringLoopMass=0.09; factorPressureLoopMass=1.5; factorForceBorder=150; // 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(3); break; case CONTOUR_FOLLOWING_FAST: @@ -520,7 +520,7 @@ totalLightForce+=lightForce[i]; // note: bad value choice (negative means TOUCH, and equal to -1), TO CHANGE this in future implementations } //== (2) Compute the "recentering vector" from the total light force, by rotating by the angleCorrection (this will give different behaviours): - recenteringVectorLoop= totalLightForce.getRotatedDeg(slidingDirection? angleCorrectionForceLoop : 140); // the hard coded value is a hack for the time being... + recenteringVectorLoop= totalLightForce.getRotatedDeg(slidingDirection? -110 : 110); // the hard coded value is a hack for the time being... // Compute redundant quantities: normRecenteringVector=recenteringVectorLoop.length(); angleRecenteringVector=recenteringVectorLoop.angleDegHoriz(); @@ -540,21 +540,25 @@ for (int i = 0; i < numMasses; i++) { if ((i%2)==0) sign*=-1; if (displaySensingBuffer.lsdTrajectory[i].lightZone>0) // this means touching something black: make SOME points attracted by it (pseudopodes!!) - but not all! - massesLoop[i].addForce(lightForce[i]*(sign<0? -1.24 : 1.4)); // sign<0 means this is a pseudopode attracted by dark zones + massesLoop[i].addForce(lightForce[i]*(sign<0? -1.8 : 1.8)); // sign<0 means this is a pseudopode attracted by dark zones else // this means something white: do nothing, all forces are towards the exterior - massesLoop[i].addForce(lightForce[i]*1.6); // this force tends to make the blob "inflate", but is not "directional" + massesLoop[i].addForce(lightForce[i]*1.5); // this force tends to make the blob "inflate", but is not "directional" } } //----(c) Forces from the recentering vector on each particle (WITH PATCHES on the loop?): if (recenteringForceOnLoop) { - vector2Df auxForce= recenteringVectorLoop*factorRecenteringLoopMass*1.0; - vector2Df auxForce2= totalLightForce.getRotatedDeg(80)*factorRecenteringLoopMass*(slidingDirection? 0 : 1)*1.8; + vector2Df auxForce= recenteringVectorLoop*factorRecenteringLoopMass*1.6; + //vector2Df auxForce2= (slidingDirection? totalLightForce.getRotatedDeg(-90) : totalLightForce.getRotatedDeg(90))*factorRecenteringLoopMass*1.5; + //vector2Df auxForce3= (slidingDirection? totalLightForce.getRotatedDeg(-90) : totalLightForce.getRotatedDeg(90))*factorRecenteringLoopMass*1.5; + vector2Df auxForce2= (slidingDirection? totalLightForce.getRotatedDeg(90) : totalLightForce.getRotatedDeg(-90))*factorRecenteringLoopMass*1.1; + vector2Df auxForce3= (slidingDirection? totalLightForce.getRotatedDeg(90) : totalLightForce.getRotatedDeg(-90))*factorRecenteringLoopMass*1.1; + int sign=1; for (int i = 0; i < numMasses; i++) { if ((i%2)==0) sign*=-1; if (displaySensingBuffer.lsdTrajectory[i].lightZone>0) {// this means touching something black: behaviour may depend on the pseudopode presence: - massesLoop[i].addForce((sign<0? auxForce2 : auxForce2)); // nothing, or sign, or corrected angle + massesLoop[i].addForce((sign<0? auxForce2 : auxForce3)); // nothing, or sign, or corrected angle } else massesLoop[i].addForce(auxForce); // this force is responsible for the behaviour (contour following or not) }