Skip to content

Commit

Permalink
- If the POSIT algorithm converges before the first iteration then th…
Browse files Browse the repository at this point in the history
…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 6f0a8fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion samples/debug-posit/posit1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/posit1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6f0a8fa

Please sign in to comment.