괜찮 았는데 ... Eigen 라이브러리에는 이미 Quaternion1.slerp (Quaternion2, float T) 함수가 있습니다. SLERP이 무엇인지 알지 못한다면 : slerp는 하나의 Quaternion과 다른 하나를 보간하고, float T는 얼마나 많은 보간을해야 하는지를 증가로 간주 할 수 있습니다. 예를 들어, slerp에 단위 쿼터니언, Y 90 ° 쿼터니언 및 플로트 T "0.5"값을 지정하면 결과는 Y 45 °의 쿼터니언입니다. slerp에 대한 자세한 내용은 google을 참조하십시오. 당신은 아이겐를 사용하는 경우
, 당신은 단순히 회전 행렬에서 쿼터니온을 할 수 있습니다 :이
Matrix3f m;
Quaternion<float> q1=m.toRotationMatrix();
를 단순히 증가 0.01와 1.00로 0.01에서가는 루프를 만들었습니다. 다른 스레드에서이 작업을 수행해야합니다.
for(double i=0.0;i<1.0;i=i+0.01)
{
//let this thread sleep for 10 millisec, this gives us a 100hertz rate
//with this, the whole animation is over in 1 second
boost::this_thread::sleep(boost::posix_time::millisec(10));
//q1= first frame, q2 = second frame
Quaternion<float> q3(q1.slerp(i,q2));
//now apply the quaternion
// for each "bone", or node you need to apply a SLERPed quaternion
m_node->setRotation(q3.toRotationMatrix());
}