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-10-18 06:36:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-18 06:36:43 +0400
commit7db9558cf6fc64545dcdb1c0291ec943a10600db (patch)
tree46a753168dad14fb9bee3f452e0b2ee1a8223f72 /source/blender/blenlib
parent03085d2caea837f17b6c330c8306ecff67888ac2 (diff)
bugfix [#24291] Error parenting a child with any negative scaling coordinate
the bug was in object_apply_mat4(), caused by applying a non-normalized matrix to the rotation. Blender 2.4x also had this problem, surprising nobody noticed!.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c20
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 77ebcb24975..294546bb222 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -102,7 +102,9 @@ void transpose_m3(float R[3][3]);
void transpose_m4(float R[4][4]);
void normalize_m3(float R[3][3]);
+void normalize_m3_m3(float R[3][3], float A[3][3]);
void normalize_m4(float R[4][4]);
+void normalize_m4_m4(float R[4][4], float A[4][4]);
void orthogonalize_m3(float R[3][3], int axis);
void orthogonalize_m4(float R[4][4], int axis);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 3b5ffa2d442..197d3676367 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -750,6 +750,14 @@ void normalize_m3(float mat[][3])
normalize_v3(mat[2]);
}
+void normalize_m3_m3(float rmat[][3], float mat[][3])
+{
+ normalize_v3_v3(rmat[0], mat[0]);
+ normalize_v3_v3(rmat[1], mat[1]);
+ normalize_v3_v3(rmat[2], mat[2]);
+}
+
+
void normalize_m4(float mat[][4])
{
float len;
@@ -762,6 +770,18 @@ void normalize_m4(float mat[][4])
if(len!=0.0) mat[2][3]/= len;
}
+void normalize_m4_m4(float rmat[][4], float mat[][4])
+{
+ float len;
+
+ len= normalize_v3_v3(rmat[0], mat[0]);
+ if(len!=0.0) rmat[0][3]= mat[0][3] / len;
+ len= normalize_v3_v3(rmat[1], mat[1]);
+ if(len!=0.0) rmat[1][3]= mat[1][3] / len;
+ len= normalize_v3_v3(rmat[2], mat[2]);
+ if(len!=0.0) rmat[2][3]= mat[2][3] / len;;
+}
+
void adjoint_m3_m3(float m1[][3], float m[][3])
{
m1[0][0]=m[1][1]*m[2][2]-m[1][2]*m[2][1];