Pulley: length1 = norm(p1 - s1) length2 = norm(p2 - s2) C0 = (length1 + ratio * length2)_initial C = C0 - (length1 + ratio * length2) u1 = (p1 - s1) / norm(p1 - s1) u2 = (p2 - s2) / norm(p2 - s2) Cdot = -dot(u1, v1 + cross(w1, r1)) - ratio * dot(u2, v2 + cross(w2, r2)) J = -[u1 cross(r1, u1) ratio *
(bA *B2Body, bB *B2Body, groundA B2Vec2, groundB B2Vec2, anchorA B2Vec2, anchorB B2Vec2, r float64)
| 104 | // = invMass1 + invI1 * cross(r1, u1)^2 + ratio^2 * (invMass2 + invI2 * cross(r2, u2)^2) |
| 105 | |
| 106 | func (def *B2PulleyJointDef) Initialize(bA *B2Body, bB *B2Body, groundA B2Vec2, groundB B2Vec2, anchorA B2Vec2, anchorB B2Vec2, r float64) { |
| 107 | def.BodyA = bA |
| 108 | def.BodyB = bB |
| 109 | def.GroundAnchorA = groundA |
| 110 | def.GroundAnchorB = groundB |
| 111 | def.LocalAnchorA = def.BodyA.GetLocalPoint(anchorA) |
| 112 | def.LocalAnchorB = def.BodyB.GetLocalPoint(anchorB) |
| 113 | dA := B2Vec2Sub(anchorA, groundA) |
| 114 | def.LengthA = dA.Length() |
| 115 | dB := B2Vec2Sub(anchorB, groundB) |
| 116 | def.LengthB = dB.Length() |
| 117 | def.Ratio = r |
| 118 | B2Assert(def.Ratio > B2_epsilon) |
| 119 | } |
| 120 | |
| 121 | func MakeB2PulleyJoint(def *B2PulleyJointDef) *B2PulleyJoint { |
| 122 | res := B2PulleyJoint{ |
nothing calls this directly
no test coverage detected