two_axis_valuator_fixed_up.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  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_TWO_AXIS_VALUATOR_FIXED_AXIS_UP_H
  9. #define IGL_TWO_AXIS_VALUATOR_FIXED_AXIS_UP_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Geometry>
  13. namespace igl
  14. {
  15. /// Applies a two-axis valuator drag rotation (as seen in Maya/Studio max) to a given rotation.
  16. ///
  17. /// @param[in] w width of the trackball context
  18. /// @param[in] h height of the trackball context
  19. /// @param[in] speed controls how fast the trackball feels, 1 is normal
  20. /// @param[in] down_quat rotation at mouse down, i.e. the rotation we're applying the
  21. /// trackball motion to (as quaternion). **Note:** Up-vector that is fixed
  22. /// is with respect to this rotation.
  23. /// @param[in] down_x position of mouse down
  24. /// @param[in] down_y position of mouse down
  25. /// @param[in] mouse_x current x position of mouse
  26. /// @param[in] mouse_y current y position of mouse
  27. /// @param[out] quat the resulting rotation (as quaternion)
  28. ///
  29. /// \see snap_to_fixed_up
  30. template <typename Scalardown_quat, typename Scalarquat>
  31. IGL_INLINE void two_axis_valuator_fixed_up(
  32. const int w,
  33. const int h,
  34. const double speed,
  35. const Eigen::Quaternion<Scalardown_quat> & down_quat,
  36. const int down_x,
  37. const int down_y,
  38. const int mouse_x,
  39. const int mouse_y,
  40. Eigen::Quaternion<Scalarquat> & quat);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "two_axis_valuator_fixed_up.cpp"
  44. #endif
  45. #endif