Lines Matching defs:Vec
50 public static class Vec {
53 public Vec() {
56 public Vec(float _x, float _y) {
60 public Vec add(Vec v) {
61 return new Vec(x + v.x, y + v.y);
63 public Vec mul(float a) {
64 return new Vec(x * a, y * a);
66 public Vec sub(Vec v) {
67 return new Vec(x - v.x, y - v.y);
72 public Vec norm() {
74 return new Vec(x*k, y*k);
82 Vec p = new Vec();
83 Vec v = new Vec();
84 LinkedList<Vec> forces = new LinkedList<Vec>();
85 LinkedList<Vec> impulses = new LinkedList<Vec>();
86 public Body(float _m, Vec _p) {
90 public void applyForce(Vec f) {
93 public void applyImpulse(Vec f) {
99 public void removeForce(Vec f) {
104 for (Vec f : impulses) {
108 for (Vec f : forces) {
133 HashMap<Integer, World.Vec> mFingers = new HashMap<Integer, World.Vec>();
135 World.Vec mGrabSpot;
204 mBody = new World.Body(mass, new World.Vec(200,200));
221 mBody.applyImpulse(new World.Vec(400000, -200000));
227 mBody.applyForce(new World.Vec(0, mass * World.GRAVITY));
231 World.Vec finger = mFingers.get(mGrabbedPointer);
237 World.Vec newPos = finger.add(mGrabSpot);
245 World.Vec finger = mFingers.get(i);
246 World.Vec springForce = finger.sub(mBody.p);
253 mBody.v = new World.Vec(0,0);
343 new World.Vec(event.getX(i), event.getY(i)));
401 World.Vec v = mFingers.get(id);
424 for (World.Vec f : mBody.forces) {