From ec48cbd267818f444e942aebd876897314165762 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 30 Jan 2010 13:15:39 +0000 Subject: utility functions is_negative_m3 & is_negative_m4, added python Mathutils access Matrix.is_negative renamed Mathutils attribute wrapped -> is_wrapped --- source/blender/blenlib/intern/math_matrix.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (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 47b99bce8ab..4765a1f4728 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1037,6 +1037,21 @@ void blend_m4_m4m4(float out[][4], float dst[][4], float src[][4], float srcweig loc_quat_size_to_mat4(out, floc, fquat, fsize); } + +int is_negative_m3(float mat[][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]) +{ + float vec[3]; + cross_v3_v3v3(vec, mat[0], mat[1]); + return (dot_v3v3(vec, mat[2]) < 0.0f); +} + /* 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... @@ -1128,4 +1143,3 @@ void print_m4(char *str, float m[][4]) printf("%f %f %f %f\n",m[0][3],m[1][3],m[2][3],m[3][3]); printf("\n"); } - -- cgit v1.2.3