public void applyForce(Vector force, double timeDelta) { velocity.addInPlace(force.scale(timeDelta / Math.Abs(mass))); position.addInPlace(velocity.scale(timeDelta)); }
public Particle(Vector pos, double _mass) { position = pos; mass = _mass; velocity = new Vector(); }
public Vector subtract(Vector v) { return new Vector(x - v.x, y - v.y); }
public double dot(Vector v) { return x * v.x + y * v.y; }
public void addInPlace(Vector v) { x += v.x; y += v.y; }
public Vector add(Vector v) { return new Vector(x + v.x, y + v.y); }