00001 #include "KX_OrientationInterpolator.h"
00002
00003 #include "MT_Matrix3x3.h"
00004 #include "KX_IScalarInterpolator.h"
00005
00006 void KX_OrientationInterpolator::Execute(float currentTime) const {
00007 MT_Vector3 eul(m_ipos[0]->GetValue(currentTime),
00008 m_ipos[1]->GetValue(currentTime),
00009 m_ipos[2]->GetValue(currentTime));
00010 MT_Scalar ci = cos(eul[0]);
00011 MT_Scalar cj = cos(eul[1]);
00012 MT_Scalar ch = cos(eul[2]);
00013 MT_Scalar si = sin(eul[0]);
00014 MT_Scalar sj = sin(eul[1]);
00015 MT_Scalar sh = sin(eul[2]);
00016 MT_Scalar cc = ci*ch;
00017 MT_Scalar cs = ci*sh;
00018 MT_Scalar sc = si*ch;
00019 MT_Scalar ss = si*sh;
00020
00021 m_target.setValue(cj*ch, sj*sc-cs, sj*cc+ss,
00022 cj*sh, sj*ss+cc, sj*cs-sc,
00023 -sj, cj*si, cj*ci);
00024 }