I have two transformation matrices and I want to interpolate between them for an animation. As mentioned here it is not possible to simply interpolate the single values. Is there an easy way to accomplish this? (I use Eigen3)
My Idea:
Eigen::Matrix4f m1; //Transformation Matrix 1
Eigen::Matrix4f m2; //Transformation Matrix 2
Eigen::Quaternion<float> quat1(m1.block<3,3>(0,0)); //This extracts rotation matrix
Eigen::Quaternion<float> quat2(m2.block<3,3>(0,0));
quat1.slerp(t,quat2); //This interpolates
//Now i need a 4x4 Matrix again
Eigen::Matrix3f rot=quat1.toRotationMatrix();
Eigen::Matrix4f newmatrix;
newmatrix.block<3,3>(0,0)=rot;
Is there something wrong with my code and is there an easy way to accomplish (rotation) matrix interpolation?