diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-26 15:15:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-26 15:15:22 +0400 |
commit | 5dc3cfc983da11ead73c079096cd21e9592ce612 (patch) | |
tree | 8201441aef3795df1ed756aa69eec5f3b2ea8708 /source/blender/blenlib/intern | |
parent | 7c58ec9337761291f9489996f2e9d630b0f6ad4e (diff) |
fix [#36282] Spin error with non uniform scale
add support for passing object matrix to bmesh transform operators.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 3f635f97ec0..8565698110e 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -930,7 +930,7 @@ void orthogonalize_m4(float mat[4][4], int axis) mul_v3_fl(mat[2], size[2]); } -int is_orthogonal_m3(float m[3][3]) +bool is_orthogonal_m3(float m[3][3]) { int i, j; @@ -944,7 +944,7 @@ int is_orthogonal_m3(float m[3][3]) return 1; } -int is_orthogonal_m4(float m[4][4]) +bool is_orthogonal_m4(float m[4][4]) { int i, j; @@ -959,7 +959,7 @@ int is_orthogonal_m4(float m[4][4]) return 1; } -int is_orthonormal_m3(float m[3][3]) +bool is_orthonormal_m3(float m[3][3]) { if (is_orthogonal_m3(m)) { int i; @@ -974,7 +974,7 @@ int is_orthonormal_m3(float m[3][3]) return 0; } -int is_orthonormal_m4(float m[4][4]) +bool is_orthonormal_m4(float m[4][4]) { if (is_orthogonal_m4(m)) { int i; @@ -989,7 +989,7 @@ int is_orthonormal_m4(float m[4][4]) return 0; } -int is_uniform_scaled_m3(float m[3][3]) +bool is_uniform_scaled_m3(float m[3][3]) { const float eps = 1e-7; float t[3][3]; @@ -1434,20 +1434,34 @@ void blend_m4_m4m4(float out[4][4], float dst[4][4], float src[4][4], const floa loc_quat_size_to_mat4(out, floc, fquat, fsize); } -int is_negative_m3(float mat[3][3]) +bool is_negative_m3(float mat[3][3]) { float vec[3]; cross_v3_v3v3(vec, mat[0], mat[1]); return (dot_v3v3(vec, mat[2]) < 0.0f); } -int is_negative_m4(float mat[4][4]) +bool is_negative_m4(float mat[4][4]) { float vec[3]; cross_v3_v3v3(vec, mat[0], mat[1]); return (dot_v3v3(vec, mat[2]) < 0.0f); } +bool is_zero_m3(float mat[3][3]) +{ + return (is_zero_v3(mat[0]) && + is_zero_v3(mat[1]) && + is_zero_v3(mat[2])); +} +bool is_zero_m4(float mat[4][4]) +{ + return (is_zero_v4(mat[0]) && + is_zero_v4(mat[1]) && + is_zero_v4(mat[2]) && + is_zero_v4(mat[3])); +} + /* make a 4x4 matrix out of 3 transform components */ /* matrices are made in the order: scale * rot * loc */ /* TODO: need to have a version that allows for rotation order... */ |