/** Get the centroid and apply the supplied transform. */ public Vec2 centroidToOut(final Transform xf, final Vec2 out) { Transform.mulToOutUnsafe(xf, m_centroid, out); return out; } }
Transform.mulToOutUnsafe(xf, v1s[i], v1);
Vec2 wALocal = proxyA.getVertex(v.indexA); Vec2 wBLocal = proxyB.getVertex(v.indexB); Transform.mulToOutUnsafe(transformA, wALocal, v.wA); Transform.mulToOutUnsafe(transformB, wBLocal, v.wB); v.w.set(v.wB).subLocal(v.wA); v.a = 0.0f; Vec2 wALocal = proxyA.getVertex(0); Vec2 wBLocal = proxyB.getVertex(0); Transform.mulToOutUnsafe(transformA, wALocal, v.wA); Transform.mulToOutUnsafe(transformB, wBLocal, v.wB); v.w.set(v.wB).subLocal(v.wA); m_count = 1;
Transform.mulToOutUnsafe(xf, circle.m_p, center); float radius = circle.m_radius; xf.q.getXAxis(axis); Transform.mulToOutUnsafe(xf, poly.m_vertices[i], vertices[i]); case EDGE: { EdgeShape edge = (EdgeShape) fixture.getShape(); Transform.mulToOutUnsafe(xf, edge.m_vertex1, v1); Transform.mulToOutUnsafe(xf, edge.m_vertex2, v2); m_debugDraw.drawSegment(v1, v2, color); Vec2[] vertices = chain.m_vertices; Transform.mulToOutUnsafe(xf, vertices[0], v1); for (int i = 1; i < count; ++i) { Transform.mulToOutUnsafe(xf, vertices[i], v2); m_debugDraw.drawSegment(v1, v2, color); m_debugDraw.drawCircle(v1, 0.05f, color);
localPointB.set(m_proxyB.getVertex(indexB)); Transform.mulToOutUnsafe(xfa, localPointA, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); Transform.mulToOutUnsafe(xfa, m_localPoint, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); float separation = Vec2.dot(pointB.subLocal(pointA), normal); return separation; Transform.mulToOutUnsafe(xfb, m_localPoint, pointB); Transform.mulToOutUnsafe(xfa, localPointA, pointA);
/** * Set the position of the body's origin and rotation. This breaks any contacts and wakes the * other bodies. Manipulating a body's transform may cause non-physical behavior. Note: contacts * are updated on the next call to World.step(). * * @param position the world position of the body's local origin. * @param angle the world rotation in radians. */ public final void setTransform(Vec2 position, float angle) { assert (m_world.isLocked() == false); if (m_world.isLocked() == true) { return; } m_xf.q.set(angle); m_xf.p.set(position); // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c); m_sweep.a = angle; m_sweep.c0.set(m_sweep.c); m_sweep.a0 = m_sweep.a; BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase; for (Fixture f = m_fixtureList; f != null; f = f.m_next) { f.synchronize(broadPhase, m_xf, m_xf); } }
localPointB.set(m_proxyB.getVertex(indexes[1])); Transform.mulToOutUnsafe(xfa, localPointA, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); Transform.mulToOutUnsafe(xfa, m_localPoint, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); Transform.mulToOutUnsafe(xfb, m_localPoint, pointB); Transform.mulToOutUnsafe(xfa, localPointA, pointA);
Transform.mulToOutUnsafe(xfa, localPointA, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); m_axis.set(pointB).subLocal(pointA); float s = m_axis.normalize(); Transform.mulToOutUnsafe(xfb, m_localPoint, pointB); Transform.mulToOutUnsafe(xfa, localPointA, pointA); Transform.mulToOutUnsafe(xfa, m_localPoint, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB);
/** Get the centroid and apply the supplied transform. */ public Vec2 centroidToOut(final Transform xf, final Vec2 out) { Transform.mulToOutUnsafe(xf, m_centroid, out); return out; } }
void solveRigid(final TimeStep step) { for (ParticleGroup group = m_groupList; group != null; group = group.getNext()) { if ((group.m_groupFlags & ParticleGroupType.b2_rigidParticleGroup) != 0) { group.updateStatistics(); Vec2 temp = tempVec; Vec2 cross = tempVec2; Rot rotation = tempRot; rotation.set(step.dt * group.m_angularVelocity); Rot.mulToOutUnsafe(rotation, group.m_center, cross); temp.set(group.m_linearVelocity).mulLocal(step.dt).addLocal(group.m_center).subLocal(cross); tempXf.p.set(temp); tempXf.q.set(rotation); Transform.mulToOut(tempXf, group.m_transform, group.m_transform); final Transform velocityTransform = tempXf2; velocityTransform.p.x = step.inv_dt * tempXf.p.x; velocityTransform.p.y = step.inv_dt * tempXf.p.y; velocityTransform.q.s = step.inv_dt * tempXf.q.s; velocityTransform.q.c = step.inv_dt * (tempXf.q.c - 1); for (int i = group.m_firstIndex; i < group.m_lastIndex; i++) { Transform.mulToOutUnsafe(velocityTransform, m_positionBuffer.data[i], m_velocityBuffer.data[i]); } } } }
final Vec2 temp = tempVec; Transform.mulTransToOutUnsafe(body.m_xf0, ap, temp); Transform.mulToOutUnsafe(body.m_xf, temp, input.p1); input.p2.x = ap.x + step.dt * av.x; input.p2.y = ap.y + step.dt * av.y;
m_sweep.localCenter.set(massData.center); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c0); m_sweep.c.set(m_sweep.c0);
Transform.mulToOutUnsafe(transformA, proxyA.getVertex(vertex.indexA), vertex.wA); Transform.mulToOutUnsafe(transformB, proxyB.getVertex(vertex.indexB), vertex.wB); vertex.w.set(vertex.wB).subLocal(vertex.wA);
m_sweep.localCenter.set(localCenter); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c0); m_sweep.c.set(m_sweep.c0);
Transform.mulToOutUnsafe(m_xf, polygonB.m_centroid, m_centroidB); Transform.mulToOutUnsafe(m_xf, polygonB.m_vertices[i], m_polygonB.vertices[i]); Rot.mulToOutUnsafe(m_xf.q, polygonB.m_normals[i], m_polygonB.normals[i]);
localPointB.set(m_proxyB.getVertex(indexB)); Transform.mulToOutUnsafe(xfa, localPointA, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); Transform.mulToOutUnsafe(xfa, m_localPoint, pointA); Transform.mulToOutUnsafe(xfb, localPointB, pointB); float separation = Vec2.dot(pointB.subLocal(pointA), normal); return separation; Transform.mulToOutUnsafe(xfb, m_localPoint, pointB); Transform.mulToOutUnsafe(xfa, localPointA, pointA);
Transform.mulToOutUnsafe(xfB, circleB.m_p, temp); Transform.mulTransToOutUnsafe(xfA, temp, Q);
/** * Set the position of the body's origin and rotation. This breaks any contacts and wakes the * other bodies. Manipulating a body's transform may cause non-physical behavior. Note: contacts * are updated on the next call to World.step(). * * @param position the world position of the body's local origin. * @param angle the world rotation in radians. */ public final void setTransform(Vec2 position, float angle) { assert (m_world.isLocked() == false); if (m_world.isLocked() == true) { return; } m_xf.q.set(angle); m_xf.p.set(position); // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c); m_sweep.a = angle; m_sweep.c0.set(m_sweep.c); m_sweep.a0 = m_sweep.a; BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase; for (Fixture f = m_fixtureList; f != null; f = f.m_next) { f.synchronize(broadPhase, m_xf, m_xf); } }
Transform.mulToOutUnsafe(m_transformA, m_polygonA.m_vertices[i], v[i]); Transform.mulToOutUnsafe(m_transformB, m_polygonB.m_vertices[i], v[i]);
void solveRigid(final TimeStep step) { for (ParticleGroup group = m_groupList; group != null; group = group.getNext()) { if ((group.m_groupFlags & ParticleGroupType.b2_rigidParticleGroup) != 0) { group.updateStatistics(); Vec2 temp = tempVec; Vec2 cross = tempVec2; Rot rotation = tempRot; rotation.set(step.dt * group.m_angularVelocity); Rot.mulToOutUnsafe(rotation, group.m_center, cross); temp.set(group.m_linearVelocity).mulLocal(step.dt).addLocal(group.m_center).subLocal(cross); tempXf.p.set(temp); tempXf.q.set(rotation); Transform.mulToOut(tempXf, group.m_transform, group.m_transform); final Transform velocityTransform = tempXf2; velocityTransform.p.x = step.inv_dt * tempXf.p.x; velocityTransform.p.y = step.inv_dt * tempXf.p.y; velocityTransform.q.s = step.inv_dt * tempXf.q.s; velocityTransform.q.c = step.inv_dt * (tempXf.q.c - 1); for (int i = group.m_firstIndex; i < group.m_lastIndex; i++) { Transform.mulToOutUnsafe(velocityTransform, m_positionBuffer.data[i], m_velocityBuffer.data[i]); } } } }