two_axis_valuator_fixed_up.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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_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. // Inputs:
  17. // w width of the trackball context
  18. // h height of the trackball context
  19. // speed controls how fast the trackball feels, 1 is normal
  20. // 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. // down_x position of mouse down
  24. // down_y position of mouse down
  25. // mouse_x current x position of mouse
  26. // mouse_y current y position of mouse
  27. // Outputs:
  28. // quat the resulting rotation (as quaternion)
  29. //
  30. // See also: snap_to_fixed_up
  31. IGL_INLINE void two_axis_valuator_fixed_up(
  32. const int w,
  33. const int h,
  34. const double speed,
  35. const Eigen::Quaterniond & down_quat,
  36. const int down_x,
  37. const int down_y,
  38. const int mouse_x,
  39. const int mouse_y,
  40. Eigen::Quaterniond & quat);
  41. }
  42. #ifdef IGL_HEADER_ONLY
  43. # include "two_axis_valuator_fixed_up.cpp"
  44. #endif
  45. #endif