Package math

Examples of math.Vector.scale()


 
  public static void applyRotationalImpulse(Vector rot, Matrix tensor, Vector impulse, Vector forceArm) {
    if (forceArm != null) {
      Vector rotImpulse = Physics.getRotationalMomentum(impulse, forceArm);
      double inertia = Physics.getMomentumOfInertia(tensor, rotImpulse);
      rot.add(rotImpulse.scale((inertia < 0.0005f) ? 0 : 1 / inertia));
    }     
  }

  /**
   * Calculates the specific momentum of inertia for a given axis from the
View Full Code Here


  public static Vector getGForce(double m1, double m2, Vector pos1, Vector pos2) {
    Vector dir = pos1.clone().invert().add(pos2);
    double r = dir.getLength();
    return (r < 0.0005f) ? dir.reset()
      : dir.scale(G * m1 * m2 / (r * r * r));
  }
 
  /**
   * Simulates a collision between two objects. As result of the simulation,
   * the given linear and angular velocities (v1, v2, rot1, rot2) of the bodies
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.