[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27112] branches/render25/intern/iksolver/ intern/IK_Solver.cpp: Render Branch: quick hack to support 4x4 matrix SVD decomposition

Brecht Van Lommel brecht at blender.org
Tue Feb 23 20:34:12 CET 2010


Revision: 27112
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27112
Author:   blendix
Date:     2010-02-23 20:34:12 +0100 (Tue, 23 Feb 2010)

Log Message:
-----------
Render Branch: quick hack to support 4x4 matrix SVD decomposition
in C, by using the TNT matrix library from the IK solver.

Modified Paths:
--------------
    branches/render25/intern/iksolver/intern/IK_Solver.cpp

Modified: branches/render25/intern/iksolver/intern/IK_Solver.cpp
===================================================================
--- branches/render25/intern/iksolver/intern/IK_Solver.cpp	2010-02-23 19:32:32 UTC (rev 27111)
+++ branches/render25/intern/iksolver/intern/IK_Solver.cpp	2010-02-23 19:34:12 UTC (rev 27112)
@@ -377,3 +377,40 @@
 	return ((result)? 1: 0);
 }
 
+#include "TNT/cmat.h"
+#include "TNT/svd.h"
+
+extern "C" {
+void TNT_svd(float m[][4], float *w, float u[][4]);
+}
+
+void TNT_svd(float m[][4], float *w, float u[][4])
+{
+	TNT::Matrix<float> M, V, U;
+	TNT::Vector<float> W, W1, W2;
+	int i, j;
+
+	M.newsize(4, 4);
+	V.newsize(4, 4);
+	U.newsize(4, 4);
+	W.newsize(4);
+	W1.newsize(4);
+	W2.newsize(4);
+
+	for(i=0; i<4; i++)
+		for(j=0; j<4; j++)
+			M[i][j]= m[j][i];
+
+	TNT::SVD(M, V, W, U, W1, W2);
+
+	for(i=0; i<4; i++)
+		w[i]= W[i];
+
+	for(i=0; i<4; i++) {
+		for(j=0; j<4; j++) {
+			m[i][j]= V[j][i];
+			u[i][j]= U[j][i];
+		}
+	}
+}
+





More information about the Bf-blender-cvs mailing list