Package net.phys2d.math

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


      float f8 = this.body1.getInvMass() + this.body2.getInvMass();
      f8 += this.body1.getInvI() * (localVector2f1.dot(localVector2f1) - f6 * f6) + this.body2.getInvI() * (localVector2f2.dot(localVector2f2) - f7 * f7);
      localContact.massTangent = (paramFloat3 / f8);
      Vector2f localVector2f4 = new Vector2f(this.body2.getVelocity());
      localVector2f4.add(MathUtil.cross(localVector2f2, this.body2.getAngularVelocity()));
      localVector2f4.sub(this.body1.getVelocity());
      localVector2f4.sub(MathUtil.cross(localVector2f1, this.body1.getAngularVelocity()));
      float f9 = this.body1.getRestitution() * this.body2.getRestitution();
      float f10 = localContact.normal.dot(localVector2f4);
      localContact.restitution = (f9 * -f10);
      localContact.restitution = Math.max(localContact.restitution, 0.0F);
View Full Code Here


      f8 += this.body1.getInvI() * (localVector2f1.dot(localVector2f1) - f6 * f6) + this.body2.getInvI() * (localVector2f2.dot(localVector2f2) - f7 * f7);
      localContact.massTangent = (paramFloat3 / f8);
      Vector2f localVector2f4 = new Vector2f(this.body2.getVelocity());
      localVector2f4.add(MathUtil.cross(localVector2f2, this.body2.getAngularVelocity()));
      localVector2f4.sub(this.body1.getVelocity());
      localVector2f4.sub(MathUtil.cross(localVector2f1, this.body1.getAngularVelocity()));
      float f9 = this.body1.getRestitution() * this.body2.getRestitution();
      float f10 = localContact.normal.dot(localVector2f4);
      localContact.restitution = (f9 * -f10);
      localContact.restitution = Math.max(localContact.restitution, 0.0F);
      float f11 = -localContact.separation / paramFloat2;
View Full Code Here

    Body localBody2 = this.body2;
    for (int i = 0; i < this.numContacts; i++)
    {
      Contact localContact = this.contacts[i];
      Vector2f localVector2f1 = new Vector2f(localContact.position);
      localVector2f1.sub(localBody1.getPosition());
      Vector2f localVector2f2 = new Vector2f(localContact.position);
      localVector2f2.sub(localBody2.getPosition());
      Vector2f localVector2f3 = new Vector2f(localBody2.getVelocity());
      localVector2f3.add(MathUtil.cross(localBody2.getAngularVelocity(), localVector2f2));
      localVector2f3.sub(localBody1.getVelocity());
View Full Code Here

    {
      Contact localContact = this.contacts[i];
      Vector2f localVector2f1 = new Vector2f(localContact.position);
      localVector2f1.sub(localBody1.getPosition());
      Vector2f localVector2f2 = new Vector2f(localContact.position);
      localVector2f2.sub(localBody2.getPosition());
      Vector2f localVector2f3 = new Vector2f(localBody2.getVelocity());
      localVector2f3.add(MathUtil.cross(localBody2.getAngularVelocity(), localVector2f2));
      localVector2f3.sub(localBody1.getVelocity());
      localVector2f3.sub(MathUtil.cross(localBody1.getAngularVelocity(), localVector2f1));
      float f1 = localVector2f3.dot(localContact.normal);
View Full Code Here

    Vector2f[] arrayOfVector2f = localLine.getVertices(paramBody1.getPosition(), paramBody1.getRotation());
    Vector2f localVector2f1 = arrayOfVector2f[0];
    Vector2f localVector2f2 = arrayOfVector2f[1];
    ROVector2f localROVector2f = paramBody2.getPosition();
    Vector2f localVector2f3 = new Vector2f(localVector2f2);
    localVector2f3.sub(localVector2f1);
    localVector2f3.set(localVector2f3.y, -localVector2f3.x);
    float f1 = localVector2f3.y * (localVector2f2.x - localVector2f1.x);
    f1 -= localVector2f3.x * (localVector2f2.y - localVector2f1.y);
    float f2 = localVector2f3.x * (localVector2f1.y - localROVector2f.getY());
    f2 -= localVector2f3.y * (localVector2f1.x - localROVector2f.getX());
View Full Code Here

      localVector2f1.sub(localBody1.getPosition());
      Vector2f localVector2f2 = new Vector2f(localContact.position);
      localVector2f2.sub(localBody2.getPosition());
      Vector2f localVector2f3 = new Vector2f(localBody2.getVelocity());
      localVector2f3.add(MathUtil.cross(localBody2.getAngularVelocity(), localVector2f2));
      localVector2f3.sub(localBody1.getVelocity());
      localVector2f3.sub(MathUtil.cross(localBody1.getAngularVelocity(), localVector2f1));
      float f1 = localVector2f3.dot(localContact.normal);
      float f2 = localContact.massNormal * (localContact.restitution - f1);
      float f3 = localContact.accumulatedNormalImpulse;
      localContact.accumulatedNormalImpulse = Math.max(f3 + f2, 0.0F);
View Full Code Here

      Vector2f localVector2f2 = new Vector2f(localContact.position);
      localVector2f2.sub(localBody2.getPosition());
      Vector2f localVector2f3 = new Vector2f(localBody2.getVelocity());
      localVector2f3.add(MathUtil.cross(localBody2.getAngularVelocity(), localVector2f2));
      localVector2f3.sub(localBody1.getVelocity());
      localVector2f3.sub(MathUtil.cross(localBody1.getAngularVelocity(), localVector2f1));
      float f1 = localVector2f3.dot(localContact.normal);
      float f2 = localContact.massNormal * (localContact.restitution - f1);
      float f3 = localContact.accumulatedNormalImpulse;
      localContact.accumulatedNormalImpulse = Math.max(f3 + f2, 0.0F);
      f2 = localContact.accumulatedNormalImpulse - f3;
View Full Code Here

      localVector2f4 = localVector2f2;
    else
      localVector2f4 = new Vector2f(localVector2f1.x + f2 * (localVector2f2.x - localVector2f1.x), localVector2f1.y + f2 * (localVector2f2.y - localVector2f1.y));
    Vector2f localVector2f5 = localVector2f3;
    localVector2f5.set(localROVector2f);
    localVector2f5.sub(localVector2f4);
    float f3 = localVector2f5.lengthSquared();
    float f4 = localCircle.getRadius() * localCircle.getRadius();
    if (f3 < f4)
    {
      paramArrayOfContact[0].setPosition(localVector2f4);
View Full Code Here

    Vector2f localVector2f1 = paramArrayOfVector2f1[paramIntersection.edgeA];
    Vector2f localVector2f2 = paramArrayOfVector2f1[((paramIntersection.edgeA + 1) % paramArrayOfVector2f1.length)];
    Vector2f localVector2f3 = paramArrayOfVector2f2[paramIntersection.edgeB];
    Vector2f localVector2f4 = paramArrayOfVector2f2[((paramIntersection.edgeB + 1) % paramArrayOfVector2f2.length)];
    Vector2f localVector2f5 = MathUtil.getNormal(localVector2f1, localVector2f2);
    localVector2f5.sub(MathUtil.getNormal(localVector2f3, localVector2f4));
    localVector2f5.normalise();
    paramContact.setNormal(localVector2f5);
    paramContact.setSeparation(0.0F);
    paramContact.setFeature(new FeaturePair(paramIntersection.edgeA, paramIntersection.edgeB, 0, 0));
    paramContact.setPosition(paramIntersection.position);
View Full Code Here

  }

  public int[][] getCollisionCandidates(Vector2f[] paramArrayOfVector2f1, Vector2f[] paramArrayOfVector2f2, Vector2f paramVector2f1, Vector2f paramVector2f2)
  {
    Vector2f localVector2f = new Vector2f(paramVector2f2);
    localVector2f.sub(paramVector2f1);
    return getCollisionCandidates(new EdgeSweep(localVector2f), paramArrayOfVector2f1, paramArrayOfVector2f2);
  }
}

/* Location:           D:\stuff\work\random\CodeTanks\#local-runner\local-runner\
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.