Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVector4, Poolable { @Override public Vector4 scaleAdd(final double scale, final ReadOnlyVector4 add, final Vector4 store) { Vector4 result = store; if (result == null) { result = new Vector4(); } result.setX(_x * scale + add.getX()); result.setY(_y * scale + add.getY()); result.setZ(_z * scale + add.getZ()); result.setW(_w * scale + add.getW()); return result; } Vector4();  Vector4(final ReadOnlyVector4 src);  Vector4(final double x, final double y, final double z, final double w); @Override double getX(); @Override double getY(); @Override double getZ(); @Override double getW(); @Override float getXf(); @Override float getYf(); @Override float getZf(); @Override float getWf(); @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); void setZ(final double z); void setW(final double w); Vector4 set(final double x, final double y, final double z, final double w); Vector4 set(final ReadOnlyVector4 source); Vector4 zero(); @Override Vector4 add(final double x, final double y, final double z, final double w, final Vector4 store); Vector4 addLocal(final double x, final double y, final double z, final double w); @Override Vector4 add(final ReadOnlyVector4 source, final Vector4 store); Vector4 addLocal(final ReadOnlyVector4 source); @Override Vector4 subtract(final double x, final double y, final double z, final double w, final Vector4 store); Vector4 subtractLocal(final double x, final double y, final double z, final double w); @Override Vector4 subtract(final ReadOnlyVector4 source, final Vector4 store); Vector4 subtractLocal(final ReadOnlyVector4 source); @Override Vector4 multiply(final double scalar, final Vector4 store); Vector4 multiplyLocal(final double scalar); @Override Vector4 multiply(final ReadOnlyVector4 scale, final Vector4 store); Vector4 multiplyLocal(final ReadOnlyVector4 scale); @Override Vector4 multiply(final double x, final double y, final double z, final double w, final Vector4 store); Vector4 multiplyLocal(final double x, final double y, final double z, final double w); @Override Vector4 divide(final double scalar, final Vector4 store); Vector4 divideLocal(final double scalar); @Override Vector4 divide(final ReadOnlyVector4 scale, final Vector4 store); Vector4 divideLocal(final ReadOnlyVector4 scale); @Override Vector4 divide(final double x, final double y, final double z, final double w, final Vector4 store); Vector4 divideLocal(final double x, final double y, final double z, final double w); Vector4 scaleAddLocal(final double scale, final Vector4 add); @Override Vector4 scaleAdd(final double scale, final ReadOnlyVector4 add, final Vector4 store); @Override Vector4 negate(final Vector4 store); Vector4 negateLocal(); @Override Vector4 normalize(final Vector4 store); Vector4 normalizeLocal(); @Override Vector4 lerp(final ReadOnlyVector4 endVec, final double scalar, final Vector4 store); Vector4 lerpLocal(final ReadOnlyVector4 endVec, final double scalar); static Vector4 lerp(final ReadOnlyVector4 beginVec, final ReadOnlyVector4 endVec, final double scalar,
      final Vector4 store); Vector4 lerpLocal(final ReadOnlyVector4 beginVec, final ReadOnlyVector4 endVec, final double scalar); @Override double length(); @Override double lengthSquared(); @Override double distanceSquared(final double x, final double y, final double z, final double w); @Override double distanceSquared(final ReadOnlyVector4 destination); @Override double distance(final double x, final double y, final double z, final double w); @Override double distance(final ReadOnlyVector4 destination); @Override double dot(final double x, final double y, final double z, final double w); @Override double dot(final ReadOnlyVector4 vec); static boolean isValid(final ReadOnlyVector4 vector); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object o); @Override Vector4 clone(); @Override Class<? extends Vector4> 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 Vector4 fetchTempInstance(); final static void releaseTempInstance(final Vector4 vec); final static ReadOnlyVector4 ZERO; final static ReadOnlyVector4 ONE; final static ReadOnlyVector4 NEG_ONE; final static ReadOnlyVector4 UNIT_X; final static ReadOnlyVector4 NEG_UNIT_X; final static ReadOnlyVector4 UNIT_Y; final static ReadOnlyVector4 NEG_UNIT_Y; final static ReadOnlyVector4 UNIT_Z; final static ReadOnlyVector4 NEG_UNIT_Z; final static ReadOnlyVector4 UNIT_W; final static ReadOnlyVector4 NEG_UNIT_W; }
@Test public void testScaleAdd() { final Vector4 vec1 = new Vector4(1, 1, 1, 1); final Vector4 vec2 = vec1.scaleAdd(2.0, new Vector4(1, 2, 3, 4), null); final Vector4 vec2B = vec1.scaleAdd(2.0, new Vector4(1, 2, 3, 4), new Vector4()); assertEquals(new Vector4(3.0, 4.0, 5.0, 6.0), vec2); assertEquals(new Vector4(3.0, 4.0, 5.0, 6.0), vec2B); vec1.scaleAddLocal(2.0, new Vector4(1, 2, 3, 4)); assertEquals(vec2, vec1); }