public static Vector2D div(Vector2D v, float scalar) { float nx = v.x * (1 / scalar); float ny = v.y * (1 / scalar); cache4.set(nx, ny); return cache4; // return new Vector2D(nx, ny); }
public static Vector2D mult(Vector2D v, float scalar) { float x = v.x * scalar; float y = v.y * scalar; cache3.set(x, y); return cache3; // return new Vector2D(x,y); }
/** * Subtract 'v2' Vector from the 'v1' Vector * * @param v1 the Vector to subtract from * @param v2 the Vector to subtract with * @return the difference */ public static Vector2D sub(Vector2D v1, Vector2D v2) { float x = v1.x - v2.x; float y = v1.y - v2.y; cache2.set(x, y); return cache2; // return new Vector2D(x,y); }
public void inverse(Vector2D in, Vector2D out) { double[] o = inverse(in.getX(), in.getY()); out.set(o); }
public void transform(Vector2D in, Vector2D out) { double[] o = transform(in.getX(), in.getY()); out.set(o); }
/** * ************************************************************************** Static Vector * Methods * * <p>TODO: Convert return variables to static cache vars */ public static Vector2D add(Vector2D v1, Vector2D v2) { float x = v1.x + v2.x; float y = v1.y + v2.y; cache1.set(x, y); return cache1; }