示例#1
0
        public EulerAngles ToEulerAngles()
        {
            EulerAngles returnValue = new EulerAngles();

              Single calculatedXPitch = (Single)Math.Asin(this[1][2]);
              Single calculatedYYaw = 0F;
              Single calculatedZRoll = 0F;

              if (Math.Cos(calculatedXPitch) > 0.001) {
            calculatedYYaw = (Single)(-Math.Atan2(this[0][2], this[2][2]));
            calculatedZRoll = (Single)Math.Atan2(this[1][0], this[1][1]);
              } else {
            calculatedYYaw = 0F;
            calculatedZRoll = (Single)Math.Atan2(-this[0][1], this[0][0]);
              }

              returnValue.xPitch = (Int32)Math.Round(Geometry.RadianToDegree(calculatedXPitch), 0);
              returnValue.yYaw = (Int32)Math.Round(Geometry.RadianToDegree(calculatedYYaw), 0);
              returnValue.zRoll = (Int32)Math.Round(Geometry.RadianToDegree(calculatedZRoll), 0);

              return returnValue;
        }
示例#2
0
 private void UpdateIlfAngles(RotationMatrix rotationMatrix)
 {
     EulerAngles eulerAngles = new EulerAngles(rotationMatrix);
       this.textBoxIlfPitch.Text = ((eulerAngles.xPitch > 0) ? "+" : String.Empty) + eulerAngles.xPitch + "°";
       this.textBoxIlfRoll.Text = ((eulerAngles.zRoll > 0) ? "+" : String.Empty) + eulerAngles.zRoll + "°";
       this.textBoxIlfYaw.Text = ((eulerAngles.yYaw > 0) ? "+" : String.Empty) + eulerAngles.yYaw + "°";
 }
示例#3
0
        public RotationMatrix(EulerAngles eulerAngles)
        {
            RotationMatrix rotationMatrix = eulerAngles.ToMatrix();

              for (Int32 row = 0; row < 3; row++) {
            for (Int32 column = 0; column < 3; column++) {
              this[row][column] = rotationMatrix[row][column];
            }
              }
        }