Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-02-06 19:45:51 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-02-06 19:45:51 +0300
commita8145c26f22f72c2756736ef829d2c247dc89d60 (patch)
tree0d93ec26898552beb8aeee3b650414c7cde9ee9d /intern/iksolver
parent03402b84199cc1615504a6031d3995e0d08eea02 (diff)
Bugfix: IK solving could go in infinite loop in SVD decomposition,
the matrix library used didn't have a maximum iterations check for degenerate cases.
Diffstat (limited to 'intern/iksolver')
-rw-r--r--intern/iksolver/intern/TNT/svd.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/intern/iksolver/intern/TNT/svd.h b/intern/iksolver/intern/TNT/svd.h
index af281d0fce0..9ca51fa2650 100644
--- a/intern/iksolver/intern/TNT/svd.h
+++ b/intern/iksolver/intern/TNT/svd.h
@@ -18,11 +18,13 @@
#include "tntmath.h"
+#define SVD_MAX_ITER 200
+
namespace TNT
{
template <class MaTRiX, class VecToR >
-void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work2) {
+void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work2, int maxiter=SVD_MAX_ITER) {
int m = A.num_rows();
int n = A.num_cols();
@@ -216,7 +218,10 @@ void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work
int kase=0;
k=0;
- // Here is where a test for too many iterations would go.
+ // Test for maximum iterations to avoid infinite loop
+ if(maxiter == 0)
+ break;
+ maxiter--;
// This section of the program inspects for
// negligible elements in the s and e arrays. On