quat_to_axis_angle.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_QUAT_TO_AXIS_ANGLE_H
  9. #define IGL_QUAT_TO_AXIS_ANGLE_H
  10. #include "igl_inline.h"
  11. namespace igl
  12. {
  13. // Convert quat representation of a rotation to axis angle
  14. // A Quaternion, q, is defined here as an arrays of four scalars (x,y,z,w),
  15. // such that q = x*i + y*j + z*k + w
  16. // Inputs:
  17. // q quaternion
  18. // Outputs:
  19. // axis 3d vector
  20. // angle scalar in radians
  21. template <typename Q_type>
  22. IGL_INLINE void quat_to_axis_angle(
  23. const Q_type *q,
  24. Q_type *axis,
  25. Q_type & angle);
  26. // Wrapper with angle in degrees
  27. template <typename Q_type>
  28. IGL_INLINE void quat_to_axis_angle_deg(
  29. const Q_type *q,
  30. Q_type *axis,
  31. Q_type & angle);
  32. }
  33. #ifndef IGL_STATIC_LIBRARY
  34. # include "quat_to_axis_angle.cpp"
  35. #endif
  36. #endif