CCVector4 implements Cloneable, Externalizable { public CCVector4 subtract(final double theX, final double theY, final double theZ, final double theW, CCVector4 theStore) { if (theStore == null) theStore = new CCVector4(); return theStore.set( x - theX, y - theY, z - theZ, w - theW ); } CCVector4(final double theX, final double theY, final double theZ, final double theW);  CCVector4(final double[] theValues);  CCVector4(final CCVector4 theSource);  CCVector4(final CCVector3 theSource, double theW);  CCVector4(final CCVector2 theSource);  CCVector4(); double getValue(final int theIndex); void setValue(final int theIndex, final double theValue); double[] toArray(double[] theStore); double[] toArray(); CCVector4 set(final double theX, final double theY, final double theZ, final double theW); CCVector4 set(final CCVector3 theVector, final double theW); CCVector4 set(final CCVector4 theSource); CCVector4 zero(); CCVector4 add(final double theX, final double theY, final double theZ, final double theW, CCVector4 theStore); CCVector4 add(final double theX, final double theY, final double theZ, final double theW); CCVector4 addLocal(final double theX, final double theY, final double theZ, final double theW); CCVector4 add(final CCVector4 theSource, CCVector4 theStore); CCVector4 add(final CCVector4 theSource); CCVector4 addLocal(final CCVector4 theSource); CCVector4 subtract(final double theX, final double theY, final double theZ, final double theW, CCVector4 theStore); CCVector4 subtract(final double theX, final double theY, final double theZ, final double theW); CCVector4 subtractLocal(final double theX, final double theY, final double theZ, final double theW); CCVector4 subtract(final CCVector4 theSource, CCVector4 theStore); CCVector4 subtract(final CCVector4 theSource); CCVector4 subtractLocal(final CCVector4 theSource); CCVector4 multiply(final double theX, final double theY, final double theZ, final double theW, CCVector4 theStore); CCVector4 multiply(final double theX, final double theY, final double theZ, final double theW); CCVector4 multiplyLocal(final double theX, final double theY, final double theZ, final double theW); CCVector4 multiply(final double theScalar, CCVector4 theStore); CCVector4 multiply(final double theScalar); CCVector4 multiplyLocal(final double theScalar); CCVector4 multiply(final CCVector4 theScale, CCVector4 theStore); CCVector4 multiply(final CCVector4 theScale); CCVector4 multiplyLocal(final CCVector4 theScale); CCVector4 divide(final double theX, final double theY, final double theZ, final double theW, CCVector4 theStore); CCVector4 divide(final double theX, final double theY, final double theZ, final double theW); CCVector4 divideLocal(final double theX, final double theY, final double theZ, final double theW); CCVector4 divide(final double theScalar, CCVector4 theStore); CCVector4 divide(final double theScalar); CCVector4 divideLocal(final double theScalar); CCVector4 divide(final CCVector4 theScale, CCVector4 theStore); CCVector4 divide(final CCVector4 theScale); CCVector4 divideLocal(final CCVector4 theScale); CCVector4 scaleAdd(final double theScale, final CCVector4 theAdd, CCVector4 theStore); CCVector4 scaleAdd(final double theScale, final CCVector4 theAdd); CCVector4 scaleAddLocal(final double theScale, final CCVector4 theAdd); CCVector4 negate(CCVector4 theStore); CCVector4 negate(); CCVector4 negateLocal(); CCVector4 normalize(CCVector4 theStore); CCVector4 normalize(); CCVector4 normalizeLocal(); static CCVector4 lerp(
		final CCVector4 theBeginVector, 
		final CCVector4 theEndVector, 
		final double theScalar, 
		CCVector4 theStore
	); static CCVector4 lerp(
		final CCVector4 theBeginVector, 
		final CCVector4 theEndVector, 
		final double theScalar
	); CCVector4 lerp(final CCVector4 theEndVector, final double theScalar, CCVector4 theStore); CCVector4 lerp(final CCVector4 theEndVector, final double theScalar); CCVector4 lerpLocal(final CCVector4 theEndVector, final double theScalar); CCVector4 lerpLocal(final CCVector4 theBeginVector, final CCVector4 theEndVector, final double theScalar); double length(); double lengthSquared(); double distanceSquared(final double theX, final double theY, final double theZ, final double theW); double distanceSquared(final CCVector4 theDestination); double distance(final double theX, final double theY, final double theZ, final double theW); double distance(final CCVector4 theDestination); double dot(final double theX, final double theY, final double theZ, final double theW); double dot(final CCVector4 theVector); static boolean isValid(final CCVector4 theVector); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object theObject); @Override CCVector4 clone(); @Override void readExternal(final ObjectInput theInput); @Override void writeExternal(final ObjectOutput theOutput); CCVector3 xyz(); final static CCVector4 ZERO; final static CCVector4 ONE; final static CCVector4 NEG_ONE; final static CCVector4 UNIT_X; final static CCVector4 NEG_UNIT_X; final static CCVector4 UNIT_Y; final static CCVector4 NEG_UNIT_Y; final static CCVector4 UNIT_Z; final static CCVector4 NEG_UNIT_Z; final static CCVector4 UNIT_W; final static CCVector4 NEG_UNIT_W; public double x; public double y; public double z; public double w; }
@Test public void testSubtract() { final CCVector4 vec1 = new CCVector4(); final CCVector4 vec2 = new CCVector4(CCVector4.ONE); vec1.subtractLocal(1, 2, 3, 4); assertEquals(new CCVector4(-1, -2, -3, -4), vec1); vec1.subtractLocal(-1, -2, -3, -4); assertEquals(CCVector4.ZERO, vec1); vec1.zero(); vec1.subtractLocal(vec2); assertEquals(CCVector4.NEG_ONE, vec1); vec1.zero(); final CCVector4 vec3 = vec1.subtract(vec2); assertEquals(CCVector4.ZERO, vec1); assertEquals(CCVector4.NEG_ONE, vec3); }