/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hatsunearu.physicssim.simulator;

import hatsunearu.physicssim.objectmodels.DraggyBall;
import hatsunearu.physicssim.objectmodels.PhysicalObject;

import java.util.Scanner;

/**
 *
 * @author hatsunearu
 */
public class PhysicsSim {

    
    static double timeToRun = 10;
    static double tickTime = 0.000005;
    static double samplingInterval = 0.1;
    
    static double vx,vy,rx,ry,m;
    
    static PhysicalObject obj = new DraggyBall(m, new Vector(vx, vy), new Vector(rx,ry), tickTime); //define your object here
	private static Scanner s;
    
    public static void main(String[] args) {
        
        s = new Scanner(System.in);
        
        System.out.println("PhysicsSim, Rev 4.0, written by hatsunearu (www.github.com/hatsunearu)\n");
        
        System.out.println("Simulation Object: "+obj.getModelName()+"\n");
        
        System.out.println("Input mass of object");
        m = s.nextDouble();
        
        System.out.println("Input Horizontal Velocity followed by Vertical Velocity");
        vx = s.nextDouble();
        vy = s.nextDouble();
        
        System.out.println("Input Horizontal Position followed by Vertical Position");
        rx = s.nextDouble();
        ry = s.nextDouble();
        
        s.nextLine();
        
        System.out.println("Do you want to define simulation parameters? y/[N]");
        if (s.nextLine().equalsIgnoreCase("y")) {
        	System.out.println("Input time to simulate, tick interval (determines accuracy), and sampling interval (how often you want to take measurements)");
            timeToRun = s.nextDouble();
            tickTime = s.nextDouble();
            samplingInterval = s.nextDouble();
        }
        
        System.out.println("\nPhysical Parameters: m = " + m+ " v = <"+vx+", "+vy+">" + " r = <"+rx+", "+ry+">");
        System.out.println("\nRun Parameters: total time = "+timeToRun+" tick interval = "+tickTime+" sampling interval = "+samplingInterval);
        
        System.out.println("Press enter to continue...");
        
        s.nextLine();
       
        System.out.println("Time\tX\tY");
        
        for(long i = 0; i <= (long)(timeToRun / tickTime); i++) {
            if(i % (samplingInterval / tickTime) == 0) {
                System.out.println(obj.getTime() + "\t" + obj.getPos().getX() + "\t" + obj.getPos().getY());
            }
            obj.tick();
        }
    }
}

@@ -506,131 +506,8 @@
     
-static PhysicalObject obj = new DraggyBall(m, new Vector(vx, vy), new Vector(rx,ry), tickTime); //define your object here%0A%09
 priv
@@ -749,92 +749,8 @@
    %0A
-        System.out.println(%22Simulation Object: %22+obj.getModelName()+%22%5Cn%22);%0A        %0A
     
@@ -1599,32 +1599,157 @@
      %7D%0A        %0A
+        PhysicalObject obj = new DraggyBall(m, new Vector(vx, vy), new Vector(rx,ry), tickTime); //define your object here%0A%0A%0A
         System.o
@@ -1842,24 +1842,24 @@
  %22+ry+%22%3E%22);%0A
-
         Syst
@@ -1988,16 +1988,92 @@
 terval);
+%0A%0A        System.out.println(%22Simulation Object: %22+obj.getModelName()+%22%5Cn%22);
 %0A       
@@ -2131,33 +2131,32 @@
 ue...%22);%0A       
- 
 %0A        s.nextL

fix mistake