CCVector2 implements Cloneable, Externalizable { public CCVector2 subtract(final double theX, final double theY, final CCVector2 theStore) { CCVector2 result = theStore; if (result == null) { result = new CCVector2(); } return result.set( x - theX, y - theY ); } CCVector2(final double theX, final double theY);  CCVector2();  CCVector2(final CCVector2 theSource);  CCVector2(final CCVector2i theSource); static double angle(final double theX1, final double theY1, final double theX2, final double theY2); static double angle(final CCVector2 theV1, CCVector2 theV2); static double angle(CCVector2 theVec); static CCVector2 toPolar(CCVector2 theCartesian); static CCVector2 toCartesian(double theAngle, double theRadius); static CCVector2 toCartesian(CCVector2 thePolar); boolean isNaN(); double getValue(final int theIndex); void setValue(final int theIndex, final double theValue); double[] toArray(double[] theStore); double[] toArray(); CCVector2 set(final double theX, final double theY); CCVector2 set(final CCVector2 theSource); CCVector2 zero(); CCVector2 add(final double theX, final double theY, final CCVector2 theStore); CCVector2 add(final double theX, final double theY); CCVector2 addLocal(final double theX, final double theY); CCVector2 add(final CCVector2 theSource, final CCVector2 theStore); CCVector2 add(final CCVector2 theSource); CCVector2 addLocal(final CCVector2 theSource); CCVector2 subtract(final double theX, final double theY, final CCVector2 theStore); CCVector2 subtract(final double theX, final double theY); CCVector2 subtractLocal(final double theX, final double theY); CCVector2 subtract(final CCVector2 theSource, final CCVector2 theStore); CCVector2 subtract(final CCVector2 theSource); CCVector2 subtractLocal(final CCVector2 theSource); CCVector2 multiply(final double theScalar, final CCVector2 theStore); CCVector2 multiply(final double theScalar); CCVector2 multiplyLocal(final double theScalar); CCVector2 multiply(final CCVector2 theScale, final CCVector2 theStore); CCVector2 multiply(final CCVector2 theScale); CCVector2 multiplyLocal(final CCVector2 theScale); CCVector2 multiply(final double theX, final double theY, final CCVector2 theStore); CCVector2 multiply(final double theX, final double theY); CCVector2 multiplyLocal(final double theX, final double theY); CCVector2 divide(final double theScalar, final CCVector2 theStore); CCVector2 divide(final double theScalar); CCVector2 divideLocal(final double theScalar); CCVector2 divide(final CCVector2 theScale, final CCVector2 theStore); CCVector2 divide(final CCVector2 theScale); CCVector2 divideLocal(final CCVector2 theScale); CCVector2 divide(final double theX, final double theY, final CCVector2 store); CCVector2 divide(final double theX, final double theY); CCVector2 divideLocal(final double theX, final double theY); CCVector2 scaleAdd(final double theScale, final CCVector2 theAdd, final CCVector2 theStore); CCVector2 scaleAdd(final double theScale, final CCVector2 theAdd); CCVector2 scaleAddLocal(final double theScale, final CCVector2 theAdd); CCVector2 negate(final CCVector2 theStore); CCVector2 negate(); CCVector2 negateLocal(); CCVector2 normalize(final CCVector2 theStore); CCVector2 normalize(); CCVector2 normalizeLocal(); CCVector2 randomize(); CCVector2 randomize(double radius); CCVector2 truncate(final double theTreshhold, final CCVector2 theStore); CCVector2 truncate(final double theTreshhold); CCVector2 truncateLocal(final double theTreshhold); CCVector2 rotateAroundOrigin(double theAngle, final boolean theClockwise, final CCVector2 theStore); CCVector2 rotateAroundOrigin(double theAngle, final boolean theClockwise); CCVector2 rotateAroundOriginLocal(double theAngle, final boolean theClockwise); CCVector2 lerp(final CCVector2 theEndVector, final double theScalar, final CCVector2 theStore); CCVector2 lerp(final CCVector2 theEndVector, final double theScalar); CCVector2 lerpLocal(final CCVector2 theEndVector, final double theScalar); static CCVector2 lerp(final CCVector2 theBeginVector, final CCVector2 theEndVector, final double theScalar, final CCVector2 theStore); static CCVector2 lerp(final CCVector2 theBeginVector, final CCVector2 theEndVector, final double theScalar); CCVector2 lerpLocal(final CCVector2 theBeginVector, final CCVector2 theEndVector, final double theScalar); static CCVector2 bezierPoint(CCVector2 a, CCVector2 b, CCVector2 c, CCVector2 d, double t); static CCVector2 circlePoint(double theAngle, double theRadius, double theMX, double theMY); double length(); double lengthSquared(); double distanceSquared(final double theX, final double theY); double distanceSquared(final CCVector2 theDestination); double distance(final double theX, final double theY); double distance(final CCVector2 theDestination); double dot(final double theX, final double theY); double dot(final CCVector2 theVector); double getPolarAngle(); double angleBetween(final CCVector2 theOtherVector); double smallestAngleBetween(final CCVector2 theOtherVector); CCVector2 cross(); CCVector2 crossLocal(); static boolean isValid(final CCVector2 theVector); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object theObject); @Override CCVector2 clone(); @Override void readExternal(final ObjectInput in); @Override void writeExternal(final ObjectOutput out); CCVector2 rotate(double r, CCVector2 theStorage); CCVector2 rotate(double r); CCVector2 rotateLocal(double r); boolean isZero(); final static CCVector2 ZERO; final static CCVector2 ONE; final static CCVector2 NEG_ONE; final static CCVector2 UNIT_X; final static CCVector2 NEG_UNIT_X; final static CCVector2 UNIT_Y; final static CCVector2 NEG_UNIT_Y; @CCProperty(name = "x")
    public double x; @CCProperty(name = "y")
	public double y; }
@Test public void testSubtract() { final CCVector2 vec1 = new CCVector2(); final CCVector2 vec2 = new CCVector2(CCVector2.ONE); vec1.subtractLocal(1, 2); assertEquals(new CCVector2(-1, -2), vec1); vec1.subtractLocal(-1, -2); assertEquals(CCVector2.ZERO, vec1); vec1.zero(); vec1.subtractLocal(vec2); assertEquals(CCVector2.NEG_ONE, vec1); vec1.zero(); final CCVector2 vec3 = vec1.subtract(vec2, new CCVector2()); assertEquals(CCVector2.ZERO, vec1); assertEquals(CCVector2.NEG_ONE, vec3); final CCVector2 vec4 = vec1.subtract(1, 0, null); assertEquals(CCVector2.ZERO, vec1); assertEquals(CCVector2.NEG_UNIT_X, vec4); }