//smooth two matrices //http://stackoverflow.com/questions/4099369/interpolate-between-rotation-matrices //http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ void testApp::smoothARMatrix() { ofVec3f trans0, trans1, transAvg; ofQuaternion rot0, rot1, rotAvg; ofVec3f scale0, scale1, scaleAvg; ofQuaternion so0, so1, soAvg; arMatrix.decompose(trans0, rot0, scale0, so0); lastMatrix.decompose(trans1, rot1, scale1, so1); transAvg = (trans0 + trans1) / 2; rotAvg = lerpQuat(0.5, rot0, rot1); scaleAvg = (scale0 + scale1) / 2; //soAvg = lerpQuat(0.5, so0, so1); //apply averaging arMatrix.makeScaleMatrix(scaleAvg); arMatrix.setRotate(rotAvg); arMatrix.setTranslation(transAvg); //don't know what to do with soAvg :-P lastMatrix = arMatrix; }
tgt::quat QuatLinearInterpolationFunction::interpolate(tgt::quat startvalue, tgt::quat endvalue, float time) const { return lerpQuat(startvalue, endvalue, time); }