Package net.phys2d.math

Examples of net.phys2d.math.Vector2f.scale()


      body1.adjustVelocity(accum1);
      body1.adjustAngularVelocity((body1.getInvI() * MathUtil.cross(r1, impulse)));
    }
    if (!body2.isStatic()) {
      Vector2f accum2 = new Vector2f(impulse);
      accum2.scale(-body2.getInvMass());
      body2.adjustVelocity(accum2);
      body2.adjustAngularVelocity(-(body2.getInvI() * MathUtil.cross(r2, impulse)));
    }
  }

View Full Code Here


    ndp.normalise();
   
    restitute = -restitutionConstant*dv.dot(ndp);
   
    Vector2f v1 = new Vector2f(ndp);
    v1.scale(-body2.getInvMass() - body1.getInvMass());

    Vector2f v2 = MathUtil.cross(MathUtil.cross(r2, ndp), r2);
    v2.scale(-body2.getInvI());
   
    Vector2f v3 = MathUtil.cross(MathUtil.cross(r1, ndp),r1);
View Full Code Here

   
    Vector2f v1 = new Vector2f(ndp);
    v1.scale(-body2.getInvMass() - body1.getInvMass());

    Vector2f v2 = MathUtil.cross(MathUtil.cross(r2, ndp), r2);
    v2.scale(-body2.getInvI());
   
    Vector2f v3 = MathUtil.cross(MathUtil.cross(r1, ndp),r1);
    v3.scale(-body1.getInvI());
   
    Vector2f K1 = new Vector2f(v1);
View Full Code Here

    Vector2f v2 = MathUtil.cross(MathUtil.cross(r2, ndp), r2);
    v2.scale(-body2.getInvI());
   
    Vector2f v3 = MathUtil.cross(MathUtil.cross(r1, ndp),r1);
    v3.scale(-body1.getInvI());
   
    Vector2f K1 = new Vector2f(v1);
    K1.add(v2);
    K1.add(v3);
   
View Full Code Here

      collideSide=COLLIDE_NONE;
      accumulateImpulse=0;
    }
    restitute+=biasImpulse;
    Vector2f impulse = new Vector2f(ndp);
    impulse.scale(accumulateImpulse);
   
    if (!body1.isStatic()) {
      Vector2f accum1 = new Vector2f(impulse);
      accum1.scale(body1.getInvMass());
      body1.adjustVelocity(accum1);
View Full Code Here

    Vector2f impulse = new Vector2f(ndp);
    impulse.scale(accumulateImpulse);
   
    if (!body1.isStatic()) {
      Vector2f accum1 = new Vector2f(impulse);
      accum1.scale(body1.getInvMass());
      body1.adjustVelocity(accum1);
      body1.adjustAngularVelocity((body1.getInvI() * MathUtil.cross(r1, impulse)));
    }
    if (!body2.isStatic()) {
      Vector2f accum2 = new Vector2f(impulse);
View Full Code Here

      body1.adjustVelocity(accum1);
      body1.adjustAngularVelocity((body1.getInvI() * MathUtil.cross(r1, impulse)));
    }
    if (!body2.isStatic()) {
      Vector2f accum2 = new Vector2f(impulse);
      accum2.scale(-body2.getInvMass());
      body2.adjustVelocity(accum2);
      body2.adjustAngularVelocity(-(body2.getInvI() * MathUtil.cross(r2, impulse)));
    }
  }

View Full Code Here

      normal = MathUtil.getNormal(vertices[m], vertices[(m+1)%length]);
    } else {
      return vertices[m];
    }
   
    normal.scale(-pm.dot(normal));
    normal.add(p);
    return normal;
  }

  /**
 
View Full Code Here

   * @param scale The amount to scale the vector by
   * @return A newly created vector - a scaled version of the new vector
   */
  public static Vector2f scale(ROVector2f a, float scale) {
    Vector2f temp = new Vector2f(a);
    temp.scale(scale);
   
    return temp;
  }
 
  /**
 
View Full Code Here

    // Apply accumulated impulse.
    accumulatedImpulse.scale(relaxation);
   
    Vector2f accum1 = new Vector2f(accumulatedImpulse);
    accum1.scale(-body1.getInvMass());
    body1.adjustVelocity(accum1);
    body1.adjustAngularVelocity(-(body1.getInvI() * MathUtil.cross(r1, accumulatedImpulse)));

    Vector2f accum2 = new Vector2f(accumulatedImpulse);
    accum2.scale(body2.getInvMass());
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.