本文整理汇总了Java中org.jbox2d.common.Mat22.mulToOutUnsafe方法的典型用法代码示例。如果您正苦于以下问题:Java Mat22.mulToOutUnsafe方法的具体用法?Java Mat22.mulToOutUnsafe怎么用?Java Mat22.mulToOutUnsafe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbox2d.common.Mat22
的用法示例。
在下文中一共展示了Mat22.mulToOutUnsafe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMat22Unsafes
import org.jbox2d.common.Mat22; //导入方法依赖的package包/类
public void testMat22Unsafes() {
Vec2 v1 = new Vec2(10, -1.3f);
Mat22 m1 = new Mat22(1, 34, -3, 3);
Mat22 m2 = new Mat22(2, -1, 4.1f, -4);
Vec2 vo = new Vec2();
Mat22 mo = new Mat22();
Mat22.mulToOutUnsafe(m1, m2, mo);
assertEquals(Mat22.mul(m1, m2), mo);
Mat22.mulToOutUnsafe(m1, v1, vo);
assertEquals(Mat22.mul(m1, v1), vo);
Mat22.mulTransToOutUnsafe(m1, m2, mo);
assertEquals(Mat22.mulTrans(m1, m2), mo);
Mat22.mulTransToOutUnsafe(m1, v1, vo);
assertEquals(Mat22.mulTrans(m1, v1), vo);
}
示例2: solveVelocityConstraints
import org.jbox2d.common.Mat22; //导入方法依赖的package包/类
@Override
public void solveVelocityConstraints(final SolverData data) {
Vec2 vB = data.velocities[m_indexB].v;
float wB = data.velocities[m_indexB].w;
// Cdot = v + cross(w, r)
final Vec2 Cdot = pool.popVec2();
Vec2.crossToOutUnsafe(wB, m_rB, Cdot);
Cdot.addLocal(vB);
final Vec2 impulse = pool.popVec2();
final Vec2 temp = pool.popVec2();
temp.set(m_impulse).mulLocal(m_gamma).addLocal(m_C).addLocal(Cdot).negateLocal();
Mat22.mulToOutUnsafe(m_mass, temp, impulse);
Vec2 oldImpulse = temp;
oldImpulse.set(m_impulse);
m_impulse.addLocal(impulse);
float maxImpulse = data.step.dt * m_maxForce;
if (m_impulse.lengthSquared() > maxImpulse * maxImpulse) {
m_impulse.mulLocal(maxImpulse / m_impulse.length());
}
impulse.set(m_impulse).subLocal(oldImpulse);
vB.x += m_invMassB * impulse.x;
vB.y += m_invMassB * impulse.y;
wB += m_invIB * Vec2.cross(m_rB, impulse);
// data.velocities[m_indexB].v.set(vB);
data.velocities[m_indexB].w = wB;
pool.pushVec2(3);
}