public final void getSearchDirection(final Vec2 out) { switch (m_count) { case 1: out.set(m_v1.w).negateLocal(); return; case 2: e12.set(m_v2.w).subLocal(m_v1.w); // use out for a temp variable real quick out.set(m_v1.w).negateLocal(); float sgn = Vec2.cross(e12, out); if (sgn > 0f) { // Origin is left of e12. Vec2.crossToOutUnsafe(1f, e12, out); return; } else { // Origin is right of e12. Vec2.crossToOutUnsafe(e12, 1f, out); return; } default: assert (false); out.setZero(); return; } }
case POINTS: { Rot.mulTransUnsafe(xfa.q, m_axis, axisA); Rot.mulTransUnsafe(xfb.q, m_axis.negateLocal(), axisB); m_axis.negateLocal(); Transform.mulToOutUnsafe(xfa, m_localPoint, pointA); Rot.mulTransUnsafe(xfb.q, normal.negateLocal(), axisB); normal.negateLocal(); Transform.mulToOutUnsafe(xfb, m_localPoint, pointB); Rot.mulTransUnsafe(xfa.q, normal.negateLocal(), axisA); normal.negateLocal();
case POINTS: { Rot.mulTransUnsafe(xfa.q, m_axis, axisA); Rot.mulTransUnsafe(xfb.q, m_axis.negateLocal(), axisB); m_axis.negateLocal(); Transform.mulToOutUnsafe(xfa, m_localPoint, pointA); Rot.mulTransUnsafe(xfb.q, normal.negateLocal(), axisB); normal.negateLocal(); Transform.mulToOutUnsafe(xfb, m_localPoint, pointB); Rot.mulTransUnsafe(xfa.q, normal.negateLocal(), axisA); normal.negateLocal();
tangent.negateLocal(); np = clipSegmentToLine(clipPoints1, incidentEdge, tangent, sideOffset1, iv1); tangent.negateLocal();
impulse.negateLocal(); final Vec2 oldImpulse = pool.popVec2(); oldImpulse.set(m_linearImpulse);
e2.set(s).negateLocal().addLocal(i + 1 < m_count ? m_vertices[i + 1] : m_vertices[0]);
final Vec2 temp = pool.popVec2(); temp.set(m_impulse).mulLocal(m_gamma).addLocal(m_C).addLocal(Cdot).negateLocal(); Mat22.mulToOutUnsafe(m_mass, temp, impulse);
b.set(Cdot1).negateLocal().subLocal(temp); m_K.solve22ToOut(Cdot1.negateLocal(), df); Cdot1.negateLocal();
Rot.mulTransUnsafe(transformA.q, d.negateLocal(), temp); vertex.indexA = proxyA.getSupport(temp); Transform.mulToOutUnsafe(transformA, proxyA.getVertex(vertex.indexA), vertex.wA); Rot.mulTransUnsafe(transformB.q, d.negateLocal(), temp); vertex.indexB = proxyB.getSupport(temp); Transform.mulToOutUnsafe(transformB, proxyB.getVertex(vertex.indexB), vertex.wB);
impulse.negateLocal();
float s = Vec2.dot(temp, normal); if (s < 0.0f) { m_axis.negateLocal(); s = -s; float s = Vec2.dot(temp, normal); if (s < 0.0f) { m_axis.negateLocal(); s = -s;
impulse1.negateLocal();
K.ey.y = mA + mB + iA * rA.x * rA.x + iB * rB.x * rB.x; K.solveToOut(C, impulse); impulse.negateLocal();
K.solveToOut(C1.negateLocal(), temp); C1.negateLocal();
Vec2.crossToOutUnsafe(wB, m_rB, Cdot); Cdot.addLocal(vB).subLocal(vA).subLocal(temp); m_mass.solve22ToOut(Cdot.negateLocal(), impulse); // just leave negated
rf.v1.set(m_v2); rf.v2.set(m_v1); rf.normal.set(m_normal1).negateLocal(); rf.sideNormal2.set(rf.sideNormal1).negateLocal(); rf.sideOffset1 = Vec2.dot(rf.sideNormal1, rf.v1); rf.sideOffset2 = Vec2.dot(rf.sideNormal2, rf.v2);
public final void getSearchDirection(final Vec2 out) { switch (m_count) { case 1: out.set(m_v1.w).negateLocal(); return; case 2: e12.set(m_v2.w).subLocal(m_v1.w); // use out for a temp variable real quick out.set(m_v1.w).negateLocal(); float sgn = Vec2.cross(e12, out); if (sgn > 0f) { // Origin is left of e12. Vec2.crossToOutUnsafe(1f, e12, out); return; } else { // Origin is right of e12. Vec2.crossToOutUnsafe(e12, 1f, out); return; } default: assert (false); out.setZero(); return; } }
impulse.negateLocal(); final Vec2 oldImpulse = pool.popVec2(); oldImpulse.set(m_linearImpulse);
final Vec2 temp = pool.popVec2(); temp.set(m_impulse).mulLocal(m_gamma).addLocal(m_C).addLocal(Cdot).negateLocal(); Mat22.mulToOutUnsafe(m_mass, temp, impulse);