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:
authorChris Blackbourn <chrisbblend@gmail.com>2022-07-14 05:40:07 +0300
committerChris Blackbourn <chrisbblend@gmail.com>2022-07-14 06:42:08 +0300
commit931779197a9ce141eccc8b8c500f9ef726a833eb (patch)
treeffefb68396a47f82833cd2932a60fb25d68bc822 /source/blender/blenlib
parent09a74ff8b6e815f3642229355be0a08dc1bcb391 (diff)
Fix T99684: Upgrade Averages Island Scale with options Scale UV and Shear
Differential Revision: https://developer.blender.org/D15421
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h1
-rw-r--r--source/blender/blenlib/intern/math_matrix.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 2cd2a299d53..c2dafbe3a1a 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -238,6 +238,7 @@ bool invert_m3_ex(float m[3][3], float epsilon);
bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], float epsilon);
bool invert_m3(float R[3][3]);
+bool invert_m2_m2(float R[2][2], const float A[2][2]);
bool invert_m3_m3(float R[3][3], const float A[3][3]);
bool invert_m4(float R[4][4]);
bool invert_m4_m4(float R[4][4], const float A[4][4]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index ce9abc36cad..fcd017b3082 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1116,6 +1116,22 @@ double determinant_m3_array_db(const double m[3][3])
m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1]));
}
+bool invert_m2_m2(float m1[2][2], const float m2[2][2])
+{
+ adjoint_m2_m2(m1, m2);
+ float det = determinant_m2(m2[0][0], m2[1][0], m2[0][1], m2[1][1]);
+
+ bool success = (det != 0.0f);
+ if (success) {
+ m1[0][0] /= det;
+ m1[1][0] /= det;
+ m1[0][1] /= det;
+ m1[1][1] /= det;
+ }
+
+ return success;
+}
+
bool invert_m3_ex(float m[3][3], const float epsilon)
{
float tmp[3][3];