vec_sub ( VECTOR* vector1, VECTOR* vector2);

Subtracts the second vector from the first, and copies the difference to the first.

Parameters:

vector1 - result
vector2 - to be subtracted

Returns:

vector1

Modifies:

vector1 = vector1 - vector2

Speed:

Fast

Algorithm:

vector1[0] -= vector2[0];
vector1[1] -= vector2[1];
vector1[2] -= vector2[2];

Example:

vec_set(v1,nullvector); // deletes v1 to 0,0,0
vec_sub(v1,v2); // v1 contains the negative of v2

See also:

Vectors, vec_add, vec_set, vec_scale, vec_dot, vec_inverse, vec_diff
► latest version online