Quote:Original post by DonDickieD
First, the inverse of a symmetric matrix is NOT euqual to its transpose!
Oops :P Don't know where I got that from.
Quote:Also the matrix omega which sometimes called the effective mass matrix is positive definite.
Let's use a common notation so others can follow as well:
Let A be the (inverse) effective mass matrix: A = J * W * JT
Let b be the errors in the velocity constraints: b = -J * v
Let x be the impulses we need to correct the velocity errors: x = lambda
a11 * x1 + a12 * x2 = b1
a21 * x1 + a22 * x2 = b2
This would be a linear system and can easily be solved with your favorite method of choice. Now assume that we have actually an LCP. The system to solve then becomes:
w1 = a11 * x1 + a12 * x2 - b1 >= 0
w2 = a21 * x1 + a22 * x2 - b2 >= 0
_and_
x1 >= 0, x2 >= 0
_and_
x1 * w1 = 0, x2 * w2 = 0
How to solve such a system is explained in the webbook I posted here (directly in the first chapter). Look for "Direct Enumeration Method". The author goes exactly through examples like the one above with pictures and everything. I couldn't do this any better here.
Once you understood this you can look at Erin's contact block solver for another example. The code is very simple to follow and understand. This gives you then an implementation example. Maybe you look at these links first and then ask some more concrete questions please. I know that this is a hard topic and it takes some time to learn this stuff. You are on a good way!
Cheers,
-Dirk
Ah, okay, I'm starting to make sense of this.
Let me try and make a bridge between the webbook you linked and what you just posted.
Let:
M = A = inverse effective mass matrix
z = x = vector of final impulse terms to apply to the constraints
q = b = vector of initial conditions
From the webbook, LCP attempts to find w,z such that:
w - Mz = q
w,z complimentary
Or, to put it in slightly more verbose notation:
Iw + (-M)z = q
that is, it's sort of a special sort of lerp.
So far so good? Now let's suppose I've plugged in my M (A) and q (b) into the LCP solver I'm using (some monstrous black box contraption), and it has spit out either a (w,z) pair or indicated some sort of error.
Does w have any special significance? If I read things right, its sole purpose is to act as a slack variable to make the equation work. Once you have your z (x) vector of impulses, you just discard the w (w representing basically the degree to which the constraints had to be clamped).
Right?
Okay, now a more open question. Let's take again a 2x2 system:
A x = b
And impose constraints of the form x0 <= 0 and -u * x0 <= x1 <= u * x0. If you graph the constraints (x0 = x, x1 = y), the first constraint says the answer must be in the second or third quadrant. The first part of the second constraint is a line with slope -u passing through the origin. The second part of the second constraint is a line with slope u passing through the origin as well.
Because all the constraints are inequalities, we can find their union and construct a "feasible region".
Here's my best attempt at a picture:
ff\ | /fff\ | /ffff\ | /fffff\ | /ffffff\ | /fffffff\ | /ffffffff\ | /fffffffff\ | /ffffffffff\|/ x------------------------ffffffffff/|fffffffff/ |ffffffff/ |fffffff/ |ffffff/ |fffff/ |ffff/ |
(edit: had the feasible region wrong in my picture)
(edit2: arg, the picture is wrong, I'll try again in a bit)
Here f's represent the feasible region. It extends to and includes the origin. x represents the solution to the unconstrained system.
Am I right that the LCP solver is basically finding the closest point in the feasible region to x? Both problems are special cases of quadratic programming, so my guess is that they're both just slightly different ways of addressing the same problem.
GJK is also a special case of quadratic programming. Ignoring for a moment the fact that the feasible region is unbounded along one direction, could you use GJK to find the closest point in the feasible region to x? Would that be the same answer as what came out of an LCP solver?
If so, that might be an interesting direction to present LCP solving from: as an extension of GJK (or vice versa). They're both pretty complex topics with lots of special vocabulary (support mapping, "feasible region", etc.), and combining them together would be pretty cool.
[Edited by - Numsgil on July 14, 2009 1:56:01 PM]