Page 1 of 1

Inverse of a block K matrix

Posted: Wed Dec 19, 2012 10:51 am
by c0der
Hi !

When combining a revolute joint and an angle constraint to form the 2x2 block K matrix consisting of four 3x3 matrices below for an elbow joint with restricted angular movement, how do I invert this matrix to solve for lambda, which seems like another matrix of two 3x1 vectors as follows:

A*lambda = b

Code: Select all

// A = JM^-1JT
//
// A = [ Ma^-1 + [~ra]TIa^-1[~ra] + Mb^-1 + [~rb]TIb^-1[~rb]		[~ra]TIa^-1 + [~rb]TIb^-1 ]
//	 [                Ia^-1[~ra] + Ib^-1[~rb]							Ia^-1 + Ib^-1	      ]

// b = -Jvi
//    = [ -va - [~ra]Twa + vb + [~rb]Twb ]
//       [                -wa + wb                 ]

Re: Inverse of a block K matrix

Posted: Thu Dec 20, 2012 9:52 am
by c0der
That's cool, I did it in Matlab and it's a 32MB file, so it's much simpler to just apply two constraints to a point separately.

Re: Inverse of a block K matrix

Posted: Wed Jan 02, 2013 6:33 pm
by Dirk Gregorius
In 2D a revolute joint with one limit would result in a 3x3 matrix. If you have N constraints the dimension of the effective mass matrix is N x N. If this isn't your result you made a mistake.

Also note that since you mention a limit you would need to solve a LCP and not a linear system (e.g. using direct enumeration). You can find an example how to solve these kinds of problems in Box2D.