Package math

Examples of math.Vector


  public static void translateObjectEuler(Vector pos, Vector v, double m,
      Vector force, double timeDelta) {
    // a*t = (F/m)*t
    // pos = 0.5at� + vt + pos_0
    // v = at + v_0
    Vector at = force.clone().scale(timeDelta / m);
    pos.add(at.clone().scale(0.5f).add(v).scale(timeDelta));
    v.add(at);
  }
View Full Code Here


   * afterwards position and velocity.
   * This method uses the two-step Leapfrog method instead of the instable Euler method.
   */
  public static Vector translateObject(Vector pos, Vector v, double m,
      Vector force, double timeDelta, Vector oldAcc) {   
    Vector acc = force.clone().scale(1 / m)
    v.add(oldAcc.add(acc).scale(0.5f * timeDelta));
    pos.add(acc.clone().scale(0.5f * timeDelta).add(v).scale(timeDelta));
    return oldAcc = acc;
  }
View Full Code Here

TOP

Related Classes of math.Vector

Copyright © 2018 www.massapicom. 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.