1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include "normalize_quat.h"
- #include "EPS.h"
- #include <cmath>
- template <typename Q_type>
- IGL_INLINE bool igl::normalize_quat(
- const Q_type *q,
- Q_type *out)
- {
-
- Q_type len = sqrt(
- q[0]*q[0]+
- q[1]*q[1]+
- q[2]*q[2]+
- q[3]*q[3]);
-
- out[0] = q[0]/len;
- out[1] = q[1]/len;
- out[2] = q[2]/len;
- out[3] = q[3]/len;
-
- return (len > igl::EPS<Q_type>());
- }
- #ifdef IGL_STATIC_LIBRARY
- template bool igl::normalize_quat<double>(double const*, double*);
- template bool igl::normalize_quat<float>(float const*, float*);
- #endif
|