public void AngleIntegrity() { var q = QuaternionHelper.EulerAnglesInDegToQuaternion(30, 0, 0); var angles = QuaternionHelper.QuaternionToEulerAnglesInDeg(q); Assert.That(angles.X, Is.EqualTo(30)); }
public void VerifyQuaternionToEulerIntegrity() { var q1 = QuaternionHelper.EulerAnglesInDegToQuaternion(30, 10, 25); var e = QuaternionHelper.QuaternionToEulerAnglesInDeg(q1); var q2 = QuaternionHelper.EulerAnglesInDegToQuaternion(e.Y, e.X, e.Z); Assert.That(q1, Is.EqualTo(q2)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var quaternion = (Quaternion)value; var angles = QuaternionHelper.QuaternionToEulerAnglesInDeg(quaternion); var axis = parameter.ToString().ToLower(); switch (axis) { case "x": return(angles.X); case "y": return(angles.Y); case "z": return(angles.Z); default: throw new Exception("Invalid parameter in QuaternionToCoordConverter."); } }