Vector Subtraction
Subtraction is very similar to addition. The subtract method does the following.
Graphically speaking you take the subtrahend (the vector on the right side of the -
) and invert it. Then it's just regular addition with the inverted vector.
Vector greenVector = new Vector(3, 0, 1);
Vector orangeVector = new Vector(2, 0, 3);
Vector purpleVector = greenVector.clone().subtract(orangeVector);

Subtraction is commonly used when finding the vector between two locations/entities.
Last updated