normalize_quat.h 587 B

12345678910111213141516171819202122232425
  1. #ifndef IGL_NORMALIZE_QUAT_H
  2. #define IGL_NORMALIZE_QUAT_H
  3. #include "igl_inline.h"
  4. namespace igl
  5. {
  6. // Normalize a quaternion
  7. // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w),
  8. // such that q = x*i + y*j + z*k + w
  9. // Inputs:
  10. // q input quaternion
  11. // Outputs:
  12. // out result of normalization, allowed to be same as q
  13. // Returns true on success, false if len(q) < EPS
  14. template <typename Q_type>
  15. IGL_INLINE bool normalize_quat(
  16. const Q_type *q,
  17. Q_type *out);
  18. };
  19. #ifdef IGL_HEADER_ONLY
  20. # include "normalize_quat.cpp"
  21. #endif
  22. #endif