a/math: Add math_vec3_normalize.

This commit is contained in:
Lubosz Sarnecki 2020-06-19 13:38:21 +02:00
parent 7c8febd03d
commit 87a5c425cf
2 changed files with 15 additions and 0 deletions
src/xrt/auxiliary/math

View file

@ -106,6 +106,16 @@ math_vec3_cross(const struct xrt_vec3 *l,
const struct xrt_vec3 *r,
struct xrt_vec3 *result);
/*!
* Normalize a vec3 in place.
*
* @relates xrt_vec3
* @ingroup aux_math
*/
void
math_vec3_normalize(struct xrt_vec3 *in);
/*
*
* Quat functions.

View file

@ -94,6 +94,11 @@ math_vec3_cross(const struct xrt_vec3 *l,
map_vec3(*result) = map_vec3(*l).cross(map_vec3(*r));
}
extern "C" void
math_vec3_normalize(struct xrt_vec3 *in)
{
map_vec3(*in) = map_vec3(*in).normalized();
}
/*
*