21 float aDiff = pModel.m_fHeadingAngle - pModel.m_fOrientationAngle;
26 else if (aDiff >
Math.PI)
33 if (pLastHeadingDiff < -Math.PI_HALF && aDiff > 0)
35 aDiff = -
Math.PI + 0.01;
36 pLastHeadingDiff = aDiff;
37 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle + aDiff;
43 else if (pLastHeadingDiff >
Math.PI_HALF && aDiff < 0)
45 aDiff =
Math.PI - 0.01;
46 pLastHeadingDiff = aDiff;
47 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle + aDiff;
54 pLastHeadingDiff = aDiff;
64 static float CONST_ROTLIMIT =
Math.PI * 0.95;
69 float aDiff = pModel.m_fHeadingAngle - pModel.m_fOrientationAngle;
71 while (aDiff < -
Math.PI)
75 while (aDiff >
Math.PI)
82 if (pLastHeadingDiff < -Math.PI_HALF && aDiff > 0)
86 else if (pLastHeadingDiff >
Math.PI_HALF && aDiff < 0)
91 pLastHeadingDiff = aDiff;
92 if (aDiff < -CONST_ROTLIMIT)
95 if (aDiff < -(
Math.PI_HALF + CONST_ROTLIMIT))
101 pModel.m_fOrientationAngle += aDiff + CONST_ROTLIMIT;
104 else if (aDiff > CONST_ROTLIMIT)
107 if (aDiff > (
Math.PI_HALF + CONST_ROTLIMIT))
109 pLastHeadingDiff = 0;
113 pModel.m_fOrientationAngle += aDiff - CONST_ROTLIMIT;
124 pLastHeadingDiff = 0;
125 pModel.m_fHeadingAngle = pModel.m_fOrientationAngle;