From a88807b6dd3d67c3706bf69a9811b30702bb531a Mon Sep 17 00:00:00 2001 From: Tom Musgrove Date: Sun, 1 Oct 2006 16:49:41 +0000 Subject: ==Mat4ToEul== a utility function to convert 4x4 matrices to a euler rotation, contributed by Joshua Lueng (aligorith) --- source/blender/blenlib/BLI_arithb.h | 6 ++++++ source/blender/blenlib/intern/arithb.c | 9 +++++++++ 2 files changed, 15 insertions(+) (limited to 'source') diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 1fab2c68458..bb2c7f0ec83 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -155,6 +155,12 @@ Mat3ToEul( float *eul ); + void +Mat4ToEul( + float tmat[][4], + float *eul +); + void compatible_eul(float *eul, float *oldrot); void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 3f687a9f780..40cf72f4242 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -2215,6 +2215,15 @@ void Mat3ToEul(float tmat[][3], float *eul) } } +void Mat4ToEul(float tmat[][4], float *eul) +{ + float tempMat[3][3]; + + Mat3CpyMat4 (tempMat, tmat); + Mat3Ortho(tempMat); + Mat3ToEul(tempMat, eul); +} + void QuatToEul( float *quat, float *eul) { float mat[3][3]; -- cgit v1.2.3