Package org.jbox2d.common

Examples of org.jbox2d.common.Transform


    m_normals[1].set(1.0f, 0.0f);
    m_normals[2].set(0.0f, 1.0f);
    m_normals[3].set(-1.0f, 0.0f);
    m_centroid.set(center);
   
    final Transform xf = poolt1;
    xf.position.set(center);
    xf.R.set(angle);
   
    // Transform vertices and normals.
    for (int i = 0; i < m_vertexCount; ++i) {
View Full Code Here


      new CreateParticleGroupCallback();
  private final ParticleDef tempParticleDef = new ParticleDef();

  public ParticleGroup createParticleGroup(ParticleGroupDef groupDef) {
    float stride = getParticleStride();
    final Transform identity = tempTransform;
    identity.setIdentity();
    Transform transform = tempTransform2;
    transform.setIdentity();
    int firstIndex = m_count;
    if (groupDef.shape != null) {
      final ParticleDef particleDef = tempParticleDef;
      particleDef.flags = groupDef.flags;
      particleDef.color = groupDef.color;
      particleDef.userData = groupDef.userData;
      Shape shape = groupDef.shape;
      transform.set(groupDef.position, groupDef.angle);
      AABB aabb = temp;
      int childCount = shape.getChildCount();
      for (int childIndex = 0; childIndex < childCount; childIndex++) {
        if (childIndex == 0) {
          shape.computeAABB(aabb, identity, childIndex);
View Full Code Here

        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++) {
View Full Code Here

 
  // djm pooling
  private final Transform pxf = new Transform();
 
  protected final void synchronizeFixtures() {
    final Transform xf1 = pxf;
    xf1.R.set(m_sweep.a0);
    // xf1.position = m_sweep.c0 - Mul(xf1.R, m_sweep.localCenter);
    Mat22.mulToOut(xf1.R, m_sweep.localCenter, xf1.position);
    xf1.position.mulLocal(-1).addLocal(m_sweep.c0);
   
View Full Code Here

      return;
    }
   
    final PolygonShape poly1; // reference polygon
    final PolygonShape poly2; // incident polygon
    Transform xf1, xf2;
    int edge1; // reference edge
    int flip;
    final float k_relativeTol = 0.98f;
    final float k_absoluteTol = 0.001f;
   
View Full Code Here

    GJK_CALLS++;
   
    final DistanceProxy proxyA = input.proxyA;
    final DistanceProxy proxyB = input.proxyB;
   
    Transform transformA = input.transformA;
    Transform transformB = input.transformB;
   
    // Initialize the simplex.
    simplex.readCache(cache, proxyA, transformA, proxyB, transformB);
   
    // Get simplex vertices as an array.
View Full Code Here

  }
 
  private void drawJoint(Joint joint) {
    Body bodyA = joint.getBodyA();
    Body bodyB = joint.getBodyB();
    Transform xf1 = bodyA.getTransform();
    Transform xf2 = bodyB.getTransform();
    Vec2 x1 = xf1.position;
    Vec2 x2 = xf2.position;
    Vec2 p1 = pool.popVec2();
    Vec2 p2 = pool.popVec2();
    joint.getAnchorA(p1);
View Full Code Here

    Body b2 = m_bodyB;
   
    m_localCenterA.set(b1.getLocalCenter());
    m_localCenterB.set(b2.getLocalCenter());
   
    Transform xf1 = b1.getTransform();
    Transform xf2 = b2.getTransform();
   
    // Compute the effective masses.
    final Vec2 r1 = pool.popVec2();
    final Vec2 r2 = pool.popVec2();
    final Vec2 temp = pool.popVec2();
View Full Code Here

    boolean sensorB = m_fixtureB.isSensor();
    boolean sensor = sensorA || sensorB;

    Body bodyA = m_fixtureA.getBody();
    Body bodyB = m_fixtureB.getBody();
    Transform xfA = bodyA.getTransform();
    Transform xfB = bodyB.getTransform();
    //log.debug("TransformA: "+xfA);
    //log.debug("TransformB: "+xfB);
   
    if (sensor) {
      Shape shapeA = m_fixtureA.getShape();
View Full Code Here

    m_bodyC = m_joint1.getBodyA();
    m_bodyA = m_joint1.getBodyB();

    // Get geometry of joint1
    Transform xfA = m_bodyA.m_xf;
    float aA = m_bodyA.m_sweep.a;
    Transform xfC = m_bodyC.m_xf;
    float aC = m_bodyC.m_sweep.a;

    if (m_typeA == JointType.REVOLUTE) {
      RevoluteJoint revolute = (RevoluteJoint)def.joint1;
      m_localAnchorC.set(revolute.m_localAnchorA);
      m_localAnchorA.set(revolute.m_localAnchorB);
      m_referenceAngleA = revolute.m_referenceAngle;
      m_localAxisC.setZero();

      coordinateA = aA - aC - m_referenceAngleA;
    } else {
      Vec2 pA = pool.popVec2();
      Vec2 temp = pool.popVec2();
      PrismaticJoint prismatic = (PrismaticJoint)def.joint1;
      m_localAnchorC.set(prismatic.m_localAnchorA);
      m_localAnchorA.set(prismatic.m_localAnchorB);
      m_referenceAngleA = prismatic.m_referenceAngle;
      m_localAxisC.set(prismatic.m_localXAxisA);

      Vec2 pC = m_localAnchorC;
      Rot.mulToOutUnsafe(xfA.q, m_localAnchorA, temp);
      temp.addLocal(xfA.p).subLocal(xfC.p);
      Rot.mulTransUnsafe(xfC.q, temp, pA);
      coordinateA = Vec2.dot(pA.subLocal(pC), m_localAxisC);
      pool.pushVec2(2);
    }

    m_bodyD = m_joint2.getBodyA();
    m_bodyB = m_joint2.getBodyB();

    // Get geometry of joint2
    Transform xfB = m_bodyB.m_xf;
    float aB = m_bodyB.m_sweep.a;
    Transform xfD = m_bodyD.m_xf;
    float aD = m_bodyD.m_sweep.a;

    if (m_typeB == JointType.REVOLUTE) {
      RevoluteJoint revolute = (RevoluteJoint)def.joint2;
      m_localAnchorD.set(revolute.m_localAnchorA);
View Full Code Here

TOP

Related Classes of org.jbox2d.common.Transform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.