/** * Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse * in one-shot cases. * * @param b * @param out the result */ public final void solve33ToOut(Vec3 b, Vec3 out) { assert (b != out); Vec3.crossToOutUnsafe(ey, ez, out); float det = Vec3.dot(ex, out); if (det != 0.0f) { det = 1.0f / det; } Vec3.crossToOutUnsafe(ey, ez, out); final float x = det * Vec3.dot(b, out); Vec3.crossToOutUnsafe(b, ez, out); final float y = det * Vec3.dot(ex, out); Vec3.crossToOutUnsafe(ey, b, out); float z = det * Vec3.dot(ex, out); out.x = x; out.y = y; out.z = z; }
protected WeldJoint(IWorldPool argWorld, WeldJointDef def) { super(argWorld, def); m_localAnchorA = new Vec2(def.localAnchorA); m_localAnchorB = new Vec2(def.localAnchorB); m_referenceAngle = def.referenceAngle; m_frequencyHz = def.frequencyHz; m_dampingRatio = def.dampingRatio; m_impulse = new Vec3(); m_impulse.setZero(); }
Cdot.set(Cdot1.x, Cdot1.y, Cdot2); impulse.negateLocal(); m_impulse.addLocal(impulse);
K.ex.set(k11, k12, k13); K.ey.set(k12, k22, k23); K.ez.set(k13, k23, k33); C.z = C2; K.solve33ToOut(C.negateLocal(), impulse); pool.pushVec3(1); pool.pushMat33(1);
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Mat33 other = (Mat33) obj; if (ex == null) { if (other.ex != null) return false; } else if (!ex.equals(other.ex)) return false; if (ey == null) { if (other.ey != null) return false; } else if (!ey.equals(other.ey)) return false; if (ez == null) { if (other.ez != null) return false; } else if (!ez.equals(other.ez)) return false; return true; } }
Cdot1.addLocal(vB).subLocal(vA).subLocal(temp); float Cdot2 = wB - wA; Cdot.set(Cdot1.x, Cdot1.y, Cdot2); impulse.negateLocal(); m_impulse.addLocal(impulse); } else if (m_limitState == LimitState.AT_LOWER) { float newImpulse = m_impulse.z + impulse.z; pool.pushVec2(1); } else { m_impulse.addLocal(impulse); pool.pushVec2(1); } else { m_impulse.addLocal(impulse);
C.set(C1.x, C1.y, C2); impulse.negateLocal(); P.set(impulse.x, impulse.y);
protected WeldJoint(IWorldPool argWorld, WeldJointDef def) { super(argWorld, def); m_localAnchorA = new Vec2(def.localAnchorA); m_localAnchorB = new Vec2(def.localAnchorB); m_referenceAngle = def.referenceAngle; m_frequencyHz = def.frequencyHz; m_dampingRatio = def.dampingRatio; m_impulse = new Vec3(); m_impulse.setZero(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Mat33 other = (Mat33) obj; if (ex == null) { if (other.ex != null) return false; } else if (!ex.equals(other.ex)) return false; if (ey == null) { if (other.ey != null) return false; } else if (!ey.equals(other.ey)) return false; if (ez == null) { if (other.ez != null) return false; } else if (!ez.equals(other.ez)) return false; return true; } }
Cdot.set(Cdot1.x, Cdot1.y, Cdot2); impulse.negateLocal(); m_impulse.addLocal(impulse);