matrix: add rotation_euler conversion

This commit is contained in:
Danny Robson 2020-07-24 13:44:32 +10:00
parent c56058d40d
commit e4eb234889

View File

@ -245,6 +245,19 @@ namespace cruft {
//template <typename T> matrix<4,4,T> scale (T);
template <typename T> matrix<4,4,T> rotation (T angle, vector<3,T> about);
/// Returns a matrix representing the rotation vector specifying the
/// concatentation of: {yaw,pitch,roll}.
template <typename ValueT>
constexpr
matrix<4,4,ValueT>
rotation_euler (vector<3,ValueT> angles)
{
return rotation (angles[1], {0,1,0}) *
rotation (angles[0], {1,0,0}) *
rotation (angles[2], {0,0,1});
}
//template <typename T> matrix<3,3,T> translation (vector<2,T>);
//template <typename T> matrix<3,3,T> scale (vector<2,T>);