Package eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math

Examples of eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math.Vector2f.scale()


    float torq = (float) Math.asin(MathUtil.cross(ndp, V))
        * compressConstant / invDT;
    float P = torq / length;
    Vector2f n = new Vector2f(ndp.y, -ndp.x);
    Vector2f impulse = new Vector2f(n);
    impulse.scale(P);
    if (!body1.isStatic()) {
      Vector2f accum1 = new Vector2f(impulse);
      accum1.scale(body1.getInvMass());
      body1.adjustVelocity(accum1);
      body1.adjustAngularVelocity((body1.getInvI() * MathUtil.cross(dp,
 
View Full Code Here


    Vector2f n = new Vector2f(ndp.y, -ndp.x);
    Vector2f impulse = new Vector2f(n);
    impulse.scale(P);
    if (!body1.isStatic()) {
      Vector2f accum1 = new Vector2f(impulse);
      accum1.scale(body1.getInvMass());
      body1.adjustVelocity(accum1);
      body1.adjustAngularVelocity((body1.getInvI() * MathUtil.cross(dp,
          impulse)));
    }
    if (!body2.isStatic()) {
View Full Code Here

      body1.adjustAngularVelocity((body1.getInvI() * MathUtil.cross(dp,
          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

            if (b.isResting() && restingBodyDetection) {
                continue;
            }

            Vector2f temp = new Vector2f(b.getForce());
            temp.scale(b.getInvMass());
            if (b.getGravityEffected()) {
                temp.add(gravity);
            }
            temp.scale(dt);
           
View Full Code Here

            Vector2f temp = new Vector2f(b.getForce());
            temp.scale(b.getInvMass());
            if (b.getGravityEffected()) {
                temp.add(gravity);
            }
            temp.scale(dt);
           
            b.adjustVelocity(temp);
           
            Vector2f damping = new Vector2f(b.getVelocity());
            damping.scale(-b.getDamping() * b.getInvMass());
 
View Full Code Here

            temp.scale(dt);
           
            b.adjustVelocity(temp);
           
            Vector2f damping = new Vector2f(b.getVelocity());
            damping.scale(-b.getDamping() * b.getInvMass());
            b.adjustVelocity(damping);
           
            b.adjustAngularVelocity(dt * b.getInvI() * b.getTorque());
            b.adjustAngularVelocity(-b.getAngularVelocity() * b.getInvI() * b.getRotDamping());
        }
View Full Code Here

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

    if (!body2.isStatic()) {
View Full Code Here

      body1.adjustAngularVelocity(-(body1.getInvI() * MathUtil.cross(r1, accumulatedImpulse)));
    }

    if (!body2.isStatic()) {
      Vector2f accum2 = new Vector2f(accumulatedImpulse);
      accum2.scale(body2.getInvMass());
      body2.adjustVelocity(accum2);
      body2.adjustAngularVelocity(body2.getInvI() * MathUtil.cross(r2, accumulatedImpulse));
    }
  }
 
View Full Code Here

    public void applyImpulse() {
    Vector2f dv = new Vector2f(body2.getVelocity());
    dv.add(MathUtil.cross(body2.getAngularVelocity(),r2));
    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
      dv.scale(-1);
      dv.add(bias); // TODO: is this baumgarte stabilization?
     
      if (dv.lengthSquared() == 0) {
        return;
      }
View Full Code Here

     
    Vector2f impulse = MathUtil.mul(M, dv);

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

    if (!body2.isStatic()) {
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.