Actually, that was NOT the problem. I put a println to show the value of v.mag was non-zero, and still not working, so I made a tester class, run this:
public class mVectorTester {
/**
* Creates a new instance of <code>mVectorTester</code>.
*/
public mVectorTester() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
mVector mv = new mVector(0,0);
long delta = 10;
double Ag = 49.0;
double Ag2 = (Ag*delta)/1000;
System.out.println(Ag2);
long lastTime = System.currentTimeMillis();
for(int i = 0;i<10;i++) {
delta = System.currentTimeMillis() - lastTime;
lastTime = System.currentTimeMillis();
Ag2 = (Ag*delta)/1000;
mv.addVector(new mVector(Ag2, 90));
System.out.println(Ag2);
try{
Thread.sleep(10);
} catch(InterruptedException e) {}
}
}
/**
* mVector.java
*
* A Vector describing either a velocity or a force
* mag - The magnitude of the vector in m/s
* dir - The direction of the vector in degrees
* @author Ralph Landon
* @version 1.00 2010/10/28
*/
private static class mVector {
public double mag;
public double dir;
public mVector(double mag, double dir) {
this.mag = mag;
this.dir = dir;
}
public void addVector(mVector v) {
double rx = v.getXComponent()+getXComponent();
double ry = v.getYComponent()+getYComponent();
System.out.println(v.mag);
System.out.println("("+v.getXComponent()+", "+v.getYComponent()+")+("+getXComponent()+", "+getYComponent()+")");
mag = Math.sqrt((rx*rx)+(ry*ry));
dir = Math.toDegrees(Math.atan(ry/rx));
System.out.println(0*Math.cos(Math.toRadians(0)));
}
public double getXComponent() {
return (mag*Math.cos(Math.toRadians(dir)));
}
public double getYComponent() {
return (mag*Math.sin(Math.toRadians(dir)));
}
public String toString() {
return mag+"@"+dir;
}
}
}