Vec vec_by_mouse(int x, int y) { Vec ans = new Vec(); ans.x = (x - dim.width / 2.) / size; ans.y = -(y - dim.height / 2.) / size; return ans; }
Vec wall_power(Ball p) { Vec ans = new Vec(); is_colide = false; ans.x = wall_power2(p.pos.x); ans.y = wall_power2(p.pos.y); if (is_colide) ans.sub_to(p.speed.mult(10)); return ans; }
Vec mult(double scalar) { Vec ans = new Vec(); ans.x = x * scalar; ans.y = y * scalar; return ans; }
Vec sub(Vec right) { Vec ans = new Vec(); ans.x = x - right.x; ans.y = y - right.y; return ans; }
Vec add(Vec right) { Vec ans = new Vec(); ans.x = x + right.x; ans.y = y + right.y; return ans; }
Vec div(double a) { Vec ans = new Vec(); ans.x = x / a; ans.y = y / a; return ans; }