microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.45k stars 371 forks source link

Added ToEuler methods to Matrix and Quaternion #115

Closed walbourn closed 2 years ago

walbourn commented 2 years ago

This adds a ToEuler method to both Matrix and Quaternion that returns a Vector3 with the x-axis, y-axis, and z-axis rotations required to create the rotation.

This uses the same rotational order as the yaw-pitch-roll functions which is "rotates about y-axis (yaw), then x-axis (pitch), then z-axis (roll)"

Also added overloads of the CreateFromYawPitchRoll methods for both Matrix and Quaternion that takes the angles as a Vector3 in the same order.