i'm afraid this is going to be a rather long-winded question.
i'm working through Box2D, and i'm trying to understand the different ways that K is constructed.
just to make things easier to read, let's say that K = Km + Kia + Kib, where:
Km = (1/Ma + 1/Ma)[1]
Ki = -r x I x r
(let's say I is short for "I^-1", [1] is the identity matrix, r is the vector from COM to point of contact/application of impulse)
i'm trying to reconcile the Ki formula from textbooks with the ones found in the Box2D source code; obviously Erin rearranged things to simplify the expressions, but i'd really like to understand how this was done, because i'm getting quite confused -- i know enough linear/vector algebra to understand what's going on, but not enough to understand exactly why certain things are the way they are!
texts give Ki = -r x I x r
my (very sketchy) understanding of this is that I is stored in the body's local frame, and the crossproducts transform I so that Ki is a measurement of how the body's rotational inertia contributes to how "heavy" the body feels at r.
i'm a bit unclear on why we'd even need to transform I from the body's local frame, since in 2D the axis of rotation (around which I measures the moment of inertia) and the world z-axis are identical no matter how the body moves! so I should already be in worldspace.. could anyone explain this?
anyway, you then calculate K, and find the impulse P = -d * K^-1 (where d is the error or delta vector.. so P is the correcting impulse, which works along -d).
this is what happens in Box2D for joints.. however, the formula Erin actually uses is:
0) Ki = -r x I x r
1) = -r x I [~r] ([~] is the skew matrix which makes [~a]b = a x b)
2) = (I x r) [~r] (since (a x b) = -(b x a))
3) = (I [~r]) [~r]
4) = I [~r]^T ~r (where ^T is transpose)
i have no idea how to go from step (3) to (4), but, i needed to arrive at [~r]^T since working through the math, Erin uses [~r]^T [~r] and not [~r][~r]. so, i suppose my first question is: how does that work?! why isn't it simply [~r][~r]?
then erin goes on to construct the matrix M = [~r]^T [~r], which is:
r.y^2 -r.x*r.y
-r.x*r.y r.x^2
(this is an "outer product" from the looks of it, but that's about all i know/understand about it)
so, my second question is: why doesn't r x I x r reduce to a scalar?
My understanding is that in 2D you can treat w (angular velocity), or c = (a x b) as scalars, but in reality they're simply 3D vectors with x=y=0, and z = the scalar.. so: r x I x r = (r x I) x r
and since I is perp to the xy plane and r is in the xy plane, (r x I) will be in the xy plane, and thus (r x I) x r will be perp to the xy plane, i.e a scalar.
my only theory is that i'm mistaken and r x I x r != (r x I) x r.. sadly i can't seem to find any references for how the Ki expression was derived to start with. my vector algebra is definitely a bit rusty though, if you can't tell

anyway.. that's for joints. moving on to normal impulses:
the textbook formula for normal impulse is:
Pn = -d.n / (n^T K n) ("." beng vector dotprod)
my understanding of this is: d.n measures the error d along the normal n (and since Pn is meant to correct the error, we want -d), and (n^T K n) measures the mass along the normal.
in Box2D, Erin has performed some sort of manipulation to arrive at:
(n^T K n)
= n^T[Km + Kia + Kib]n
= Km + Kia_n + Kib_n
where Ki_n = I*(r.r - (r.n)^2)
so, third question: how did we go from (n^T K n) to Ki_n?
I realise that to play it safe i could simply stick to Ki = -r x I x r = I [~r]^T ~r (i.e build the 2x2 [~r]^T[~r] matrix) and use that everywhere.. however, i'd _really_ like to understand what's going on behind the scenes.
finally, if i take it as a given that Ki_n = I*(r.r - (r.n)^2) for any vector n, then to find P (i.e an impulse that works along all directions) could i simply do:
P = Pu + Pv (where u and v are the world basis vectors)
.. i could then use the simpler expression Ki_n = I*(r.r - (r.n)^2) to find Ku and Kv, and i'd never have to build or invert a 2x2 matrix.
does this make any sense, or would i be doing the exact same amount of work?
I'm sorry for the extreme length of this post, and also if i'm competely overlooking some simple fact; i've been trying to work out the algebra, and i haven't really gotten anywhere.. argh. if only i had paid more attention in school

anyway, any help or references would be appreciated, i'm trying to learn and it's becoming somewhat frustrating!