improve LMA converging ability on zoom cases and limit max iterations to 3k instead of 5k

This commit is contained in:
Jonathan Bosson
2017-06-23 15:24:07 -06:00
parent 7bb83abe08
commit 5caf871e06
2 changed files with 5 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ OTHER DEALINGS IN THE SOFTWARE.
// set parameters required by levmarq() to default values
void levmarq_init(LMstat *lmstat) {
lmstat->verbose = false;
lmstat->max_it = 5000;
lmstat->max_it = 3000;
lmstat->init_lambda = 1e-6;
lmstat->up_factor = 10;
lmstat->down_factor = 10;

View File

@@ -260,8 +260,8 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
// clamp min step size to a fraction of the incoming parameter
if (i == 2) {
double epsilon = 1e-4;
h = std::max(std::max(std::abs(dPar.at(i)), epsilon) * 0.01, h); // make sure incoming parameter is larger than 0
double epsilon = 1e-3;
h = std::max(std::max(std::abs(dPar.at(i)), epsilon) * 0.001, h); // make sure incoming parameter is larger than 0
}
else if (ptr->nDOF == 2) {
h = std::max(std::abs(dPar.at(i)) * 0.001, h);
@@ -349,6 +349,7 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
}
else { // prevents touch to infinitely be active (due to windows bridge case where event doesnt get consumed sometimes when LMA fails to converge)
OnScreenGUIModule::touchInput = { 1, glm::dvec2(0.0, 0.0), 1 };
resetAfterInput();
}
}
@@ -472,7 +473,7 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
}
// we have roll if one finger is still, or the total roll angles around the centroid is over _rollAngleThreshold (_centroidStillThreshold is used to void misinterpretations)
else if (std::abs(minDiff) < _inputStillThreshold || (std::abs(rollOn) < 100.0 && glm::distance(_centroid, lastCentroid) / list.size() < _centroidStillThreshold)) {
return ROLL; // also interpret if angles are high
return ROLL;
}
else {
return PINCH;