public void TestAsQuaternion() { var twist = new Twist(0.4f); var swing = new Swing(0.2f, 0.3f); var twistSwing = new TwistSwing(twist, swing); MathAssert.AreEqual( twist.AsQuaternion(CartesianAxis.X).Chain(swing.AsQuaternion(CartesianAxis.X)), twistSwing.AsQuaternion(CartesianAxis.X), Acc); MathAssert.AreEqual( twist.AsQuaternion(CartesianAxis.X).Chain(swing.AsQuaternion(CartesianAxis.X)), twistSwing.AsQuaternion(CartesianAxis.X), Acc); MathAssert.AreEqual( twist.AsQuaternion(CartesianAxis.X).Chain(swing.AsQuaternion(CartesianAxis.X)), twistSwing.AsQuaternion(CartesianAxis.X), Acc); MathAssert.AreEqual( twist.AsQuaternion(CartesianAxis.X).Chain(swing.AsQuaternion(CartesianAxis.X)), twistSwing.AsQuaternion(CartesianAxis.X), Acc); }
public Quaternion GetRotation(ChannelOutputs outputs) { OrientationSpace orientationSpace = GetOrientationSpace(outputs); Vector3 rotationAngles = Rotation.GetValue(outputs); TwistSwing rotationTwistSwing = RotationOrder.FromTwistSwingAngles(MathExtensions.DegreesToRadians(rotationAngles)); rotationTwistSwing = RotationConstraint.Clamp(rotationTwistSwing); Quaternion orientedSpaceRotation = rotationTwistSwing.AsQuaternion(RotationOrder.TwistAxis); Quaternion worldSpaceRotation = orientationSpace.TransformFromOrientedSpace(orientedSpaceRotation); return(worldSpaceRotation); }