Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVector2, Poolable { @Override public Vector2 scaleAdd(final double scale, final ReadOnlyVector2 add, final Vector2 store) { Vector2 result = store; if (result == null) { result = new Vector2(); } result.setX(_x * scale + add.getX()); result.setY(_y * scale + add.getY()); return result; } Vector2();  Vector2(final ReadOnlyVector2 src);  Vector2(final double x, final double y); @Override double getX(); @Override double getY(); @Override float getXf(); @Override float getYf(); @Override double getValue(final int index); void setValue(final int index, final double value); @Override double[] toArray(double[] store); void setX(final double x); void setY(final double y); Vector2 set(final double x, final double y); Vector2 set(final ReadOnlyVector2 source); Vector2 zero(); @Override Vector2 add(final double x, final double y, final Vector2 store); Vector2 addLocal(final double x, final double y); @Override Vector2 add(final ReadOnlyVector2 source, final Vector2 store); Vector2 addLocal(final ReadOnlyVector2 source); @Override Vector2 subtract(final double x, final double y, final Vector2 store); Vector2 subtractLocal(final double x, final double y); @Override Vector2 subtract(final ReadOnlyVector2 source, final Vector2 store); Vector2 subtractLocal(final ReadOnlyVector2 source); @Override Vector2 multiply(final double scalar, final Vector2 store); Vector2 multiplyLocal(final double scalar); @Override Vector2 multiply(final ReadOnlyVector2 scale, final Vector2 store); Vector2 multiplyLocal(final ReadOnlyVector2 scale); @Override Vector2 multiply(final double x, final double y, final Vector2 store); Vector2 multiplyLocal(final double x, final double y); @Override Vector2 divide(final double scalar, final Vector2 store); Vector2 divideLocal(final double scalar); @Override Vector2 divide(final ReadOnlyVector2 scale, final Vector2 store); Vector2 divideLocal(final ReadOnlyVector2 scale); @Override Vector2 divide(final double x, final double y, final Vector2 store); Vector2 divideLocal(final double x, final double y); Vector2 scaleAddLocal(final double scale, final ReadOnlyVector2 add); @Override Vector2 scaleAdd(final double scale, final ReadOnlyVector2 add, final Vector2 store); @Override Vector2 negate(final Vector2 store); Vector2 negateLocal(); @Override Vector2 normalize(final Vector2 store); Vector2 normalizeLocal(); @Override Vector2 rotateAroundOrigin(double angle, final boolean clockwise, final Vector2 store); Vector2 rotateAroundOriginLocal(double angle, final boolean clockwise); @Override Vector2 lerp(final ReadOnlyVector2 endVec, final double scalar, final Vector2 store); Vector2 lerpLocal(final ReadOnlyVector2 endVec, final double scalar); static Vector2 lerp(final ReadOnlyVector2 beginVec, final ReadOnlyVector2 endVec, final double scalar,
      final Vector2 store); Vector2 lerpLocal(final ReadOnlyVector2 beginVec, final ReadOnlyVector2 endVec, final double scalar); @Override double length(); @Override double lengthSquared(); @Override double distanceSquared(final double x, final double y); @Override double distanceSquared(final ReadOnlyVector2 destination); @Override double distance(final double x, final double y); @Override double distance(final ReadOnlyVector2 destination); @Override double dot(final double x, final double y); @Override double dot(final ReadOnlyVector2 vec); @Override double getPolarAngle(); @Override double angleBetween(final ReadOnlyVector2 otherVector); @Override double smallestAngleBetween(final ReadOnlyVector2 otherVector); static boolean isValid(final ReadOnlyVector2 vector); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object o); @Override Vector2 clone(); @Override Class<? extends Vector2> getClassTag(); @Override void write(final OutputCapsule capsule); @Override void read(final InputCapsule capsule); @Override void readExternal(final ObjectInput in); @Override void writeExternal(final ObjectOutput out); final static Vector2 fetchTempInstance(); final static void releaseTempInstance(final Vector2 vec); final static ReadOnlyVector2 ZERO; final static ReadOnlyVector2 ONE; final static ReadOnlyVector2 NEG_ONE; final static ReadOnlyVector2 UNIT_X; final static ReadOnlyVector2 NEG_UNIT_X; final static ReadOnlyVector2 UNIT_Y; final static ReadOnlyVector2 NEG_UNIT_Y; }
@Test public void testScaleAdd() { final Vector2 vec1 = new Vector2(1, 1); final Vector2 vec2 = vec1.scaleAdd(2.0, new Vector2(1, 2), null); final Vector2 vec2B = vec1.scaleAdd(2.0, new Vector2(1, 2), new Vector2()); assertEquals(new Vector2(3.0, 4.0), vec2); assertEquals(new Vector2(3.0, 4.0), vec2B); vec1.scaleAddLocal(2.0, new Vector2(1, 2)); assertEquals(vec2, vec1); }