Add set_null_vector() function

Set the vector to a null vector.
This commit is contained in:
hasufell 2014-05-12 19:49:23 +02:00
parent 20d013c401
commit 366da0177c
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 20 additions and 0 deletions

View File

@ -165,3 +165,22 @@ bool copy_vector(vector *a, vector *b)
return true;
}
/**
* Set the vector to a null vector.
*
* @param a vector [out]
* @return true/false for success/failure
*/
bool set_null_vector(vector *a)
{
if (!a)
return false;
a->x = 0;
a->y = 0;
a->z = 0;
return true;
}

View File

@ -48,6 +48,7 @@ bool add_vectors(vector *a, vector *b, vector *c);
bool sub_vectors(vector *a, vector *b, vector *c);
bool normalize_vector(vector *a, vector *b);
bool copy_vector(vector *a, vector *b);
bool set_null_vector(vector *a);
#endif /* _DROW_ENGINE_VEC_MATH_H */