What is it trying to do?

Started by
3 comments, last by johnstanp 14 years, 10 months ago
Hi Guys, With this code snippet,

jacobian[index]=axis.cross(tempvec);

// J * JT jacobian = j
const real	x=jacobian[index].x;
const real	y=jacobian[index].y;
const real	z=jacobian[index].z;
const real	xy=x*y;
const real	xz=x*z;
const real	yz=y*z;

tempmat[0][0]+=x*x;
tempmat[0][1]+=xy;
tempmat[0][2]+=xz;

tempmat[1][0]+=xy;
tempmat[1][1]+=y*y;
tempmat[1][2]+=yz;

tempmat[2][0]+=xz;
tempmat[2][1]+=yz;
tempmat[2][2]+=z*z;
I'd like to know what this code is doing? A matrix multiplied by its transpose? And why? x*x xy xz xy y*y yz xz yz z*z Thanks in advance Jack
Advertisement
You'll do this sort of thing alot when you are calculating the inverse kinematics of a system. Check out: http://math.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf

Quote:Original post by mmakrzem
You'll do this sort of thing alot when you are calculating the inverse kinematics of a system. Check out: http://math.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf


Sorry, my english is bad, so there was a misunderstanding here.
I'd like to know if the code snippet is doing a multiplication of a matrix with its transpose..
Thanks :)
Jack
That matrix formed by x y and z is the product of (x y z) as a column with (x y z) as a row. In that sense, it is the product of a matrix with its transpose.

Does that answer your question?
You can see it as a tensor product( actually it is ), that is to say, the multiplication of a vector by its transpose:

A = v * transpose( v ) ( A is a 3x3 matrix and v a column vector, that is to say, a 3x1 matrix )

or

A = transpose( v ) * v ( A is a 3x3 matrix and v a row vector, that is to say, a 1x3 matrix )

This topic is closed to new replies.

Advertisement