Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVector4, Poolable { @Override public Vector4 lerp(final ReadOnlyVector4 endVec, final double scalar, final Vector4 store) { Vector4 result = store; if (result == null) { result = new Vector4(); } final double x = (1.0 - scalar) * getX() + scalar * endVec.getX(); final double y = (1.0 - scalar) * getY() + scalar * endVec.getY(); final double z = (1.0 - scalar) * getZ() + scalar * endVec.getZ(); final double w = (1.0 - scalar) * getW() + scalar * endVec.getW(); return result.set(x, y, z, w); } 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 testLerp() { final Vector4 vec1 = new Vector4(8, 3, -2, 2); final Vector4 vec2 = new Vector4(2, 1, 0, -2); assertEquals(new Vector4(5, 2, -1, 0), vec1.lerp(vec2, 0.5, null)); assertEquals(new Vector4(5, 2, -1, 0), vec1.lerp(vec2, 0.5, new Vector4())); assertEquals(new Vector4(5, 2, -1, 0), Vector4.lerp(vec1, vec2, 0.5, null)); assertEquals(new Vector4(5, 2, -1, 0), Vector4.lerp(vec1, vec2, 0.5, new Vector4())); vec1.set(14, 5, 4, 2); vec1.lerpLocal(vec2, 0.25); assertEquals(new Vector4(11, 4, 3, 1), vec1); vec1.set(15, 7, 6, 8); final Vector4 vec3 = new Vector4(-1, -1, -1, -1); vec3.lerpLocal(vec1, vec2, 0.5); assertEquals(new Vector4(8.5, 4.0, 3.0, 3.0), vec3); assertEquals(vec1.lerp(vec1, .25, null), vec1); assertEquals(vec2.lerpLocal(vec2, .25), vec2); assertEquals(vec2.lerpLocal(vec2, vec2, .25), vec2); assertEquals(Vector4.lerp(vec1, vec1, .25, null), vec1); }