Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-30 16:15:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-30 16:15:39 +0300
commitec48cbd267818f444e942aebd876897314165762 (patch)
treec2548c58f90ade1ce0be637cd9bb828f2107bbc9 /source/blender/blenlib
parent7a76bc9a361e6cb45e4292c0ac5c7bb08936b829 (diff)
utility functions is_negative_m3 & is_negative_m4, added python Mathutils access Matrix.is_negative
renamed Mathutils attribute wrapped -> is_wrapped
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h3
-rw-r--r--source/blender/blenlib/intern/math_matrix.c16
2 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 5667fb79332..0a442687ffc 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -148,6 +148,9 @@ void loc_quat_size_to_mat4(float R[4][4],
void blend_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], float t);
void blend_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], float t);
+int is_negative_m3(float mat[3][3]);
+int is_negative_m4(float mat[4][4]);
+
/*********************************** Other ***********************************/
void print_m3(char *str, float M[3][3]);
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");
}
-