From fbca69c69afb370ddc5a0b52e10d9db61c025752 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Oct 2015 07:02:51 +1100 Subject: BLI_math: add mat3_normalized_to_* functions Many uses of matrices for rotation keep them normalized, so no need to normalize each time. --- source/blender/blenlib/intern/math_matrix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/blenlib/intern/math_matrix.c') diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 4bf6d162970..19d116928fd 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1549,7 +1549,7 @@ void mat4_to_loc_quat(float loc[3], float quat[4], float wmat[4][4]) negate_m3(mat3_n); } - mat3_to_quat(quat, mat3_n); + mat3_normalized_to_quat(quat, mat3_n); copy_v3_v3(loc, wmat[3]); } @@ -1557,7 +1557,7 @@ void mat4_decompose(float loc[3], float quat[4], float size[3], float wmat[4][4] { float rot[3][3]; mat4_to_loc_rot_size(loc, rot, size, wmat); - mat3_to_quat(quat, rot); + mat3_normalized_to_quat(quat, rot); } /** @@ -1692,8 +1692,8 @@ void blend_m3_m3m3(float out[3][3], float dst[3][3], float src[3][3], const floa mat3_to_rot_size(drot, dscale, dst); mat3_to_rot_size(srot, sscale, src); - mat3_to_quat(dquat, drot); - mat3_to_quat(squat, srot); + mat3_normalized_to_quat(dquat, drot); + mat3_normalized_to_quat(squat, srot); /* do blending */ interp_qt_qtqt(fquat, dquat, squat, srcweight); @@ -1715,8 +1715,8 @@ void blend_m4_m4m4(float out[4][4], float dst[4][4], float src[4][4], const floa mat4_to_loc_rot_size(dloc, drot, dscale, dst); mat4_to_loc_rot_size(sloc, srot, sscale, src); - mat3_to_quat(dquat, drot); - mat3_to_quat(squat, srot); + mat3_normalized_to_quat(dquat, drot); + mat3_normalized_to_quat(squat, srot); /* do blending */ interp_v3_v3v3(floc, dloc, sloc, srcweight); -- cgit v1.2.3