Examples of mulLocal()


Examples of org.jbox2d.common.Vec2.mulLocal()

          }
        }else if(Vec2.dot(pBToShape, vecBToA)<0){
          if(pBToShape.lengthSquared()>ASBOTXConfigs.E_SQUARE){
            pBToShape.negateLocal();
            pBToShape.normalize();
            pBToShape.mulLocal(FORCE_MAGNITUDE);
            dc.getBody().applyForce(pBToShape,shapePos);
          }
        }else{
          dc.getBody().applyForce(Vec2.cross(pAToShape,vecAToB)>0?forces[0]:forces[1],shapePos);
        }
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

      for(Physical ps:contactShapes){
        if(!ps.isDestroyed()){
          body=ps.getBody();
          imp=body.getLinearVelocity().clone();
         
          imp.mulLocal(IMPULSE_MAGNITUDE);
          body.applyLinearImpulse(imp, body.getWorldCenter());
        }
      }
      contactShapes.clear();
     
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

        v=center.sub(dc.getBody().getPosition());
        float lengthS=v.lengthSquared();
       
        if(lengthS>ASBOTXConfigs.E_SQUARE){
          v.normalize();
          v.mulLocal((float)radius*K*dc.getBody().getMass());
          dc.getBody().applyForce(v, dc.getBody().getWorldCenter());
        }
      }
    }
  }
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

      delta.set(toExtrude * (normals[i].x + normals[next].x), toExtrude
          * (normals[i].y + normals[next].y));
      // sumdeltax += dx;
      float norm = delta.length();
      if (norm > Settings.maxLinearCorrection) {
        delta.mulLocal(Settings.maxLinearCorrection / norm);
      }
      if (norm > Settings.linearSlop) {
        done = false;
      }
      bodies[next].m_sweep.c.x += delta.x;
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

    s.setZero();
    // This code would put the reference point inside the polygon.
    for (int i = 0; i < m_count; ++i) {
      s.addLocal(m_vertices[i]);
    }
    s.mulLocal(1.0f / m_count);

    final float k_inv3 = 1.0f / 3.0f;

    final Vec2 e1 = pool3;
    final Vec2 e2 = pool4;
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

      float translationx = v.x * h;
      float translationy = v.y * h;
      if (translationx * translationx + translationy * translationy > Settings.maxTranslationSquared) {
        float ratio = Settings.maxTranslation
            / MathUtils.sqrt(translationx * translationx + translationy * translationy);
        v.mulLocal(ratio);
      }

      float rotation = h * w;
      if (rotation * rotation > Settings.maxRotationSquared) {
        float ratio = Settings.maxRotation / MathUtils.abs(rotation);
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

   * @return
   */
  public final Vec2 getCenter() {
    final Vec2 center = new Vec2(lowerBound);
    center.addLocal(upperBound);
    center.mulLocal(.5f);
    return center;
  }

  public final void getCenterToOut(final Vec2 out) {
    out.x = (lowerBound.x + upperBound.x) * .5f;
 
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

   * @return
   */
  public final Vec2 getExtents() {
    final Vec2 center = new Vec2(upperBound);
    center.subLocal(lowerBound);
    center.mulLocal(.5f);
    return center;
  }

  public final void getExtentsToOut(final Vec2 out) {
    out.x = (upperBound.x - lowerBound.x) * .5f;
 
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

      float translationy = v.y * h;
      if (translationx * translationx + translationy * translationy > Settings.maxTranslationSquared) {
        float ratio =
            Settings.maxTranslation
                / MathUtils.sqrt(translationx * translationx + translationy * translationy);
        v.mulLocal(ratio);
      }

      float rotation = h * w;
      if (rotation * rotation > Settings.maxRotationSquared) {
        float ratio = Settings.maxRotation / MathUtils.abs(rotation);
View Full Code Here

Examples of org.jbox2d.common.Vec2.mulLocal()

      delta.set(toExtrude * (normals[i].x + normals[next].x), toExtrude
          * (normals[i].y + normals[next].y));
      // sumdeltax += dx;
      float normSqrd = delta.lengthSquared();
      if (normSqrd > Settings.maxLinearCorrection * Settings.maxLinearCorrection) {
        delta.mulLocal(Settings.maxLinearCorrection / MathUtils.sqrt(normSqrd));
      }
      if (normSqrd > Settings.linearSlop * Settings.linearSlop) {
        done = false;
      }
      positions[bodies[next].m_islandIndex].c.x += delta.x;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.