Examples of mulLocal()


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()

      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()

   * @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()

      final int next = (i == bodies.length - 1) ? 0 : i + 1;
      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

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

      // Check for large velocities
      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()

        // Time step: v(t + dt) = v0 * exp(-c * (t + dt)) = v0 * exp(-c * t) * exp(-c * dt) = v *
        // exp(-c * dt)
        // v2 = exp(-c * dt) * v1
        // Taylor expansion:
        // v2 = (1.0f - c * dt) * v1
        v.mulLocal(MathUtils.clamp(1.0f - h * b.m_linearDamping, 0.0f, 1.0f));
        w *= MathUtils.clamp(1.0f - h * b.m_angularDamping, 0.0f, 1.0f);
      }
// assert (v.x == 0);

      m_positions[i].c.set(c);
View Full Code Here

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

      // Check for large velocities
      translation.set(v).mulLocal(h);
      if (Vec2.dot(translation, translation) > Settings.maxTranslationSquared) {
        float ratio = Settings.maxTranslation / translation.length();
        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()

    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()

   *
   * @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
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.