SLERP and Animation

The RotateTransform3D class defines a property named Rotation that you set to an object of type Rotation3D, which is an abstract class from which both AxisAngleRotation3D and QuaternionRotation3D descend. In previous chapters, I've shown only AxisAngleRotation3D. QuaternionRotation3D has a single property named Quaternion of type Quaternion. In XAML, it looks like this:

<RotateTransform3D>
    <RotateTransform3D.Rotation>
        <QuaternionRotation3D Quaternion="0 0 0.5 0.866" />
    </RotateTransform3D.Rotation>
</RotateTransform3D>

That's a rotation of 60 degrees around the Z axis or (0, 0, 1). The number 0.5 is the sine of half the angle (or 30 degrees), and 0.866 is the cosine of 30 degrees. Remember: In XAML, the w term comes last. You ...

Get 3D Programming for Windows® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.