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:
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.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 2b0c3db21ee..241acebffa3 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -57,6 +57,7 @@ void copy_m4_m4_db(double m1[4][4], const double m2[4][4]);
void copy_m3_m3d(float m1[3][3], const double m2[3][3]);
/* float->double */
+void copy_m3d_m3(double m1[3][3], const float m2[3][3]);
void copy_m4d_m4(double m1[4][4], const float m2[4][4]);
void swap_m3m3(float m1[3][3], float m2[3][3]);
@@ -291,6 +292,7 @@ float determinant_m3(
float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3);
float determinant_m3_array(const float m[3][3]);
float determinant_m4_mat3_array(const float m[4][4]);
+double determinant_m3_array_db(const double m[3][3]);
float determinant_m4(const float m[4][4]);
#define PSEUDOINVERSE_EPSILON 1e-8f
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 554506e90e7..b6d80d76be1 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -180,6 +180,21 @@ void copy_m4_m2(float m1[4][4], const float m2[2][2])
m1[3][3] = 1.0f;
}
+void copy_m3d_m3(double m1[3][3], const float m2[3][3])
+{
+ m1[0][0] = m2[0][0];
+ m1[0][1] = m2[0][1];
+ m1[0][2] = m2[0][2];
+
+ m1[1][0] = m2[1][0];
+ m1[1][1] = m2[1][1];
+ m1[1][2] = m2[1][2];
+
+ m1[2][0] = m2[2][0];
+ m1[2][1] = m2[2][1];
+ m1[2][2] = m2[2][2];
+}
+
void copy_m4d_m4(double m1[4][4], const float m2[4][4])
{
m1[0][0] = m2[0][0];
@@ -1113,6 +1128,13 @@ float determinant_m4_mat3_array(const float m[4][4])
m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1]));
}
+double determinant_m3_array_db(const double m[3][3])
+{
+ return (m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
+ m[1][0] * (m[0][1] * m[2][2] - m[0][2] * m[2][1]) +
+ m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1]));
+}
+
bool invert_m3_ex(float m[3][3], const float epsilon)
{
float tmp[3][3];