12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "rotate_by_quat.h"
- #include "quat_conjugate.h"
- #include "quat_mult.h"
- #include "normalize_quat.h"
- #include <cassert>
- template <typename Q_type>
- IGL_INLINE void igl::rotate_by_quat(
- const Q_type *v,
- const Q_type *q,
- Q_type *out)
- {
-
-
- Q_type quat_v[4] = {v[0],v[1],v[2],0};
-
- Q_type normalized_q[4];
- #ifndef NDEBUG
- bool normalized =
- #endif
- igl::normalize_quat<Q_type>(q,normalized_q);
- #ifndef NDEBUG
- assert(normalized);
- #endif
-
- Q_type q_conj[4];
- igl::quat_conjugate<Q_type>(normalized_q,q_conj);
-
-
-
- Q_type q_mult_quat_v[4];
- igl::quat_mult<Q_type>(normalized_q,quat_v,q_mult_quat_v);
-
- igl::quat_mult<Q_type>(q_mult_quat_v,q_conj,out);
- }
- #ifdef IGL_STATIC_LIBRARY
- template void igl::rotate_by_quat<double>(double const*, double const*, double*);
- template void igl::rotate_by_quat<float>(float const*, float const*, float*);
- #endif
|