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>2013-07-26 10:12:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-26 10:12:49 +0400
commit29df776b89691cc44b6d88afd5956a64aba88058 (patch)
tree858ed9eff812b2a72ef710d47f10f1d9c82b7ba7 /source/blender/blenlib/intern
parent501649a806db6b1175694254f4be3fe249f90163 (diff)
optimization: call one bmesh operator for rotate (not 3).
added pivot_m4() utility function since rotating about an arbitrary point is handy.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/math_matrix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 312805e23f6..3f635f97ec0 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1374,6 +1374,21 @@ void rotate_m2(float mat[2][2], const float angle)
mat[1][0] = -mat[0][1];
}
+/* scale or rotate around a non zero pivot */
+void pivot_m4(float mat[4][4], const float pivot[3])
+{
+ float tmat[4][4];
+
+ unit_m4(tmat);
+
+ copy_v3_v3(tmat[3], pivot);
+ mul_m4_m4m4(mat, tmat, mat);
+
+ /* invert the matrix */
+ negate_v3(tmat[3]);
+ mul_m4_m4m4(mat, mat, tmat);
+}
+
void blend_m3_m3m3(float out[3][3], float dst[3][3], float src[3][3], const float srcweight)
{
float srot[3][3], drot[3][3];