[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13591] trunk/blender/intern/iksolver/ intern/TNT/svd.h:

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Feb 6 17:45:51 CET 2008


Revision: 13591
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13591
Author:   blendix
Date:     2008-02-06 17:45:51 +0100 (Wed, 06 Feb 2008)

Log Message:
-----------

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.

Modified Paths:
--------------
    trunk/blender/intern/iksolver/intern/TNT/svd.h

Modified: trunk/blender/intern/iksolver/intern/TNT/svd.h
===================================================================
--- trunk/blender/intern/iksolver/intern/TNT/svd.h	2008-02-06 13:45:07 UTC (rev 13590)
+++ trunk/blender/intern/iksolver/intern/TNT/svd.h	2008-02-06 16:45:51 UTC (rev 13591)
@@ -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 @@
 		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





More information about the Bf-blender-cvs mailing list