Thank you alot for your response!
The Jacobian is by inspection (note that you need to transpose the gradient vector when you insert it into the matrix - hence the "T"!):
J = ( -nT nT )
Is transposing the vector(/matrix) needed in 2D? I thought, the Jacobian was just
J = JT = n
Because I thought in 2D the Jacobian is just a vector and not a matrix?
Now for two rigid bodies. We want to constraint two arbitrary points on the surface of each body. We write the position constraint as:
C = |p2 - p1| - L where p = x + R * r' = x + r ( x is the center of mass, R is the current orientation matrix and r' is the vector from p to some point on the body in local coordinates - hence the prime to denote the local frame and without the prime after we transformed to world space r = R * r')
I saved r for each body in local coordinates in the constraint, so I just have to rotate it (in 2D) at the beginning of every frame ( in the prestep method ) to get r1 and r2 in world space.
dC/dt = (p2 - p1) / |p2 - p1| * (dp2/dt - dp1/dt) = n * ( dp2/dt - dp1/dt ) = n * ( v2 + cross( omega2, r2 ) - v1 - cross( omega1, r1 ) )
The trick is to realize that the inner derivative (dp2/dt - dp1/dt) is just the relative velocity at the two points.
The Jacobian now becomes:
J = ( -nT -cross( r1, n )T nT cross( r2, n )T )
So, with "isolate v" it is not meant, that I just take out the v, but I also need to get the omega out there somehow... I think I understand
Ok now I have that formula:
J * W * JT * lambda = -J * v
Now how to calculate W ( or M )... Is it always the same for a constraint?
I think I know too less about vector and matrix maths, but how can the direction of the impulse ( the Jacobian) be a vector with 4 elements?
Thanks again
Edit:
I read the Paper "Siggraph 97" and it sais, that M is just a nxn(2x2 for 2 bodies) Matrix where the diagonal elements are the mass of the bodies, and the others are zero. It also sais, that a diagonal matrix can just be seen as a vector...