Skip to content
Permalink
Browse files

- If the POSIT algorithm converges before the first iteration then th…

…e first calculated error value is returned instead of undefined.

It fixes #6
  • Loading branch information...
jcmellado committed Apr 10, 2015
1 parent 18c06f0 commit 6f0a8fab334debd3e407f12f9495090b2190a7d5
Showing with 2 additions and 2 deletions.
  1. +1 −1 samples/debug-posit/posit1.js
  2. +1 −1 src/posit1.js
@@ -280,7 +280,7 @@ POS.Posit.prototype.iterate = function(imagePoints, posRotation, posTranslation,
rotation[i][2] * this.objectPoints[0][2]);
}

error1 = this.error(imagePoints, rotation, translation1);
error = error1 = this.error(imagePoints, rotation, translation1);

//Convergence
converged = (0.0 === error1.pixels) || (imageDifference < 0.01);
@@ -280,7 +280,7 @@ POS.Posit.prototype.iterate = function(imagePoints, posRotation, posTranslation,
rotation[i][2] * this.objectPoints[0][2]);
}

error1 = this.error(imagePoints, rotation, translation1);
error = error1 = this.error(imagePoints, rotation, translation1);

//Convergence
converged = (0.0 === error1.pixels) || (imageDifference < 0.01);

0 comments on commit 6f0a8fa

Please sign in to comment.
You can’t perform that action at this time.