|
@@ -8,33 +8,34 @@
|
|
|
#include "two_axis_valuator_fixed_up.h"
|
|
|
#include "PI.h"
|
|
|
|
|
|
+template <typename Scalardown_quat, typename Scalarquat>
|
|
|
IGL_INLINE void igl::two_axis_valuator_fixed_up(
|
|
|
const int w,
|
|
|
const int h,
|
|
|
const double speed,
|
|
|
- const Eigen::Quaterniond & down_quat,
|
|
|
+ const Eigen::Quaternion<Scalardown_quat> & down_quat,
|
|
|
const int down_x,
|
|
|
const int down_y,
|
|
|
const int mouse_x,
|
|
|
const int mouse_y,
|
|
|
- Eigen::Quaterniond & quat)
|
|
|
+ Eigen::Quaternion<Scalarquat> & quat)
|
|
|
{
|
|
|
using namespace Eigen;
|
|
|
- Vector3d axis(0,1,0);
|
|
|
+ Matrix<Scalarquat,3,1> axis(0,1,0);
|
|
|
quat = down_quat *
|
|
|
- Quaterniond(
|
|
|
- AngleAxisd(
|
|
|
- PI*((double)(mouse_x-down_x))/(double)w*speed/2.0,
|
|
|
+ Quaternion<Scalarquat>(
|
|
|
+ AngleAxis<Scalarquat>(
|
|
|
+ PI*((Scalarquat)(mouse_x-down_x))/(Scalarquat)w*speed/2.0,
|
|
|
axis.normalized()));
|
|
|
quat.normalize();
|
|
|
{
|
|
|
- Vector3d axis(1,0,0);
|
|
|
+ Matrix<Scalarquat,3,1> axis(1,0,0);
|
|
|
if(axis.norm() != 0)
|
|
|
{
|
|
|
quat =
|
|
|
- Quaterniond(
|
|
|
- AngleAxisd(
|
|
|
- PI*(mouse_y-down_y)/(double)h*speed/2.0,
|
|
|
+ Quaternion<Scalarquat>(
|
|
|
+ AngleAxis<Scalarquat>(
|
|
|
+ PI*(mouse_y-down_y)/(Scalarquat)h*speed/2.0,
|
|
|
axis.normalized())) * quat;
|
|
|
quat.normalize();
|
|
|
}
|