Constraint Formulation

I'm sure you are tired of the constant questions....

I'm looking at the line/prismatic joints now. Looking at the linear constraint for both:
Code:
C = perp.dot(d) where d = p2 - p1 = x2 + r2 - x1 - r1

When I perform the derivative I get confused:
Code:
dC/dt = perp * d(d)/dt + d(perp)/dt * d


What is the derivative of perp? I thought maybe:
Code:
d(perp)/dt = d(cross(d, 1.0))/dt

But when I finish the derivation I don't end with the same Jacobian as in the source.

Is that right or is there something special I need to do here?
The time derivative of a fixed-length vector in a rotating frame is:

dv/dt = cross(omega, v)

I'm just using that along with the chain-rule.
Ok right.... I knew that, sorry. For the angular velocity, is there a reason why w1 is used? I was thinking it would have been the relative angular velocity.
Code:
cross(w1, perp)
Because perp is fixed in body1. You can't have a vector fixed in both bodies unless those bodies are fixed together. In that case the relative angular velocity would be zero. From this you can see that it never makes sense to use the relative angular velocity when computing the time derivative of a vector that is fixed in a body.
Yes, that makes perfect sense. This means that we could have used w2 instead of w1 if we fix perp to be in body2's coordinate frame.

Original thread: https://box2d.org/forum/viewtopic.php?t=4996