private void Operation(String op) { Quaternion quatA = new Quaternion(0,0,0,0); Quaternion quatB = new Quaternion(0,0,0,0); Quaternion quatResult = new Quaternion(0,0,0,0); Double doubleResult = 0.0f; switch (op) { case "add": quatA = parseStringToQuat(OPQuatABox.Text); quatB = parseStringToQuat(OPQuatBBox.Text); quatResult = quatA.add(quatB); OPResultBox.Text = quatResult.ToString(); break; case "subtract": quatA = parseStringToQuat(OPQuatABox.Text); quatB = parseStringToQuat(OPQuatBBox.Text); quatResult = quatA.subtract(quatB); OPResultBox.Text = quatResult.ToString(); break; case "multiply": quatA = parseStringToQuat(OPQuatABox.Text); quatB = parseStringToQuat(OPQuatBBox.Text); quatResult = quatA.multiply(quatB); OPResultBox.Text = quatResult.ToString(); break; case "divide": quatA = parseStringToQuat(OPQuatABox.Text); quatB = parseStringToQuat(OPQuatBBox.Text); quatResult = quatA.divide(quatB); OPResultBox.Text = quatResult.ToString(); break; case "inverse": quatA = parseStringToQuat(IMQuatBox.Text); quatResult = quatA.inverse(); IMResultBox.Text = quatResult.ToString(); break; case "magnitude": quatA = parseStringToQuat(IMQuatBox.Text); doubleResult = quatA.magnitude(); IMResultBox.Text = doubleResult.ToString(); break; case "rotate": quatA = parseStringToQuat(RQuatABox.Text); quatB = parseStringToQuat(RQuatBBox.Text); double angleNumerator = 1.0f; if (!string.IsNullOrWhiteSpace(RAngleNumerator.Text)) angleNumerator = Convert.ToDouble(RAngleNumerator.Text); double piInNumerator = 1.0f; if (RAngleIncludePIInNumerator.IsChecked.Value) piInNumerator = Math.PI; double angleDenominator = Convert.ToDouble(RAngleDenominator.Text); double angle = (angleNumerator * piInNumerator) / angleDenominator; quatResult = Quaternion.rotatePointByAngleAboutAxisVector(quatA, angle, quatB); RResultBox.Text = quatResult.ToString(); break; default: break; } }