[Bf-blender-cvs] [8bee9af4622] master: BLI: double version of some math functions.

YimingWu noreply at git.blender.org
Tue Aug 20 15:10:21 CEST 2019


Commit: 8bee9af462238936087e0056d97cf086c2f7059a
Author: YimingWu
Date:   Tue Aug 20 21:09:55 2019 +0800
Branches: master
https://developer.blender.org/rB8bee9af462238936087e0056d97cf086c2f7059a

BLI: double version of some math functions.

===================================================================

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	source/blender/blenlib/BLI_math_base.h
M	source/blender/blenlib/BLI_math_matrix.h
M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_base_inline.c
M	source/blender/blenlib/intern/math_matrix.c
M	source/blender/blenlib/intern/math_vector.c
M	source/blender/blenlib/intern/math_vector_inline.c
M	source/tools

===================================================================

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 63f65770e67..ad82c4ce43e 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 63f65770e67f38db29f76ac910dd87bd9841b919
+Subproject commit ad82c4ce43ef2801ef51e75af1f9702992478b02
diff --git a/release/scripts/addons b/release/scripts/addons
index 37a8bdc6616..8e6f485cf5b 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 37a8bdc661649cb6197e73b5eb96481cd5fb0c5e
+Subproject commit 8e6f485cf5b160c425d7da7c743879b20f3d6a96
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index d9ed9d4d064..7077ff07384 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit d9ed9d4d064c74c86e2767cd4be32d602a0ee317
+Subproject commit 7077ff07384491d1f7630484995557f1c7302dae
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 5b941f570de..deb29605552 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -112,6 +112,7 @@ MINLINE float saasin(float fac);
 MINLINE float sasqrt(float fac);
 
 MINLINE float interpf(float a, float b, float t);
+MINLINE double interpd(double a, double b, double t);
 
 MINLINE float min_ff(float a, float b);
 MINLINE float max_ff(float a, float b);
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 52d976daa2d..f5d87667b73 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -41,6 +41,7 @@ void zero_m4(float R[4][4]);
 void unit_m2(float R[2][2]);
 void unit_m3(float R[3][3]);
 void unit_m4(float R[4][4]);
+void unit_m4_db(double m[4][4]);
 
 void copy_m2_m2(float R[2][2], const float A[2][2]);
 void copy_m3_m3(float R[3][3], const float A[3][3]);
@@ -48,9 +49,14 @@ void copy_m4_m4(float R[4][4], const float A[4][4]);
 void copy_m3_m4(float R[3][3], const float A[4][4]);
 void copy_m4_m3(float R[4][4], const float A[3][3]);
 
+void copy_m4_m4_db(double m1[4][4], const double m2[4][4]);
+
 /* double->float */
 void copy_m3_m3d(float R[3][3], const double A[3][3]);
 
+/* float->double */
+void copy_m4d_m4(double R[4][4], const float A[4][4]);
+
 void swap_m3m3(float A[3][3], float B[3][3]);
 void swap_m4m4(float A[4][4], float B[4][4]);
 
@@ -82,6 +88,8 @@ void mul_m3_m3m3_uniq(float R[3][3], const float A[3][3], const float B[3][3]);
 void mul_m3_m3_pre(float R[3][3], const float A[3][3]);
 void mul_m3_m3_post(float R[3][3], const float B[3][3]);
 void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4]);
+void mul_m4_m4m4_db_uniq(double R[4][4], const double A[4][4], const double B[4][4]);
+void mul_m4db_m4db_m4fl_uniq(double R[4][4], const double A[4][4], const float B[4][4]);
 void mul_m4_m4_pre(float R[4][4], const float A[4][4]);
 void mul_m4_m4_post(float R[4][4], const float B[4][4]);
 
@@ -173,11 +181,14 @@ void _va_mul_m4_series_9(float R[4][4],
 
 void mul_m4_v3(const float M[4][4], float r[3]);
 void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3]);
+void mul_v3_m4v3_db(double r[3], const double mat[4][4], const double vec[3]);
+void mul_v4_m4v3_db(double r[4], const double mat[4][4], const double vec[3]);
 void mul_v2_m4v3(float r[2], const float M[4][4], const float v[3]);
 void mul_v2_m2v2(float r[2], const float M[2][2], const float v[2]);
 void mul_m2v2(const float M[2][2], float v[2]);
 void mul_mat3_m4_v3(const float M[4][4], float r[3]);
 void mul_v3_mat3_m4v3(float r[3], const float M[4][4], const float v[3]);
+void mul_v3_mat3_m4v3_db(double r[3], const double M[4][4], const double v[3]);
 void mul_m4_v4(const float M[4][4], float r[4]);
 void mul_v4_m4v4(float r[4], const float M[4][4], const float v[4]);
 void mul_v4_m4v3(float r[4], const float M[4][4], const float v[3]); /* v has implicit w = 1.0f */
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 2815046865d..ccb42683d5a 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -106,6 +106,7 @@ MINLINE void add_v2_v2(float r[2], const float a[2]);
 MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]);
 MINLINE void add_v2_v2v2_int(int r[2], const int a[2], const int b[2]);
 MINLINE void add_v3_v3(float r[3], const float a[3]);
+MINLINE void add_v3_v3_db(double r[3], const double a[3]);
 MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void add_v4_v4(float r[4], const float a[4]);
 MINLINE void add_v4_v4v4(float r[4], const float a[4], const float b[4]);
@@ -119,6 +120,7 @@ MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2]);
 MINLINE void sub_v3_v3(float r[3], const float a[3]);
 MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], const int b[3]);
+MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3]);
 MINLINE void sub_v4_v4(float r[4], const float a[4]);
 MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]);
 
@@ -127,6 +129,7 @@ MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3])
 MINLINE void mul_v2_fl(float r[2], float f);
 MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f);
 MINLINE void mul_v3_fl(float r[3], float f);
+MINLINE void mul_v3db_db(double r[3], double f);
 MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f);
 MINLINE void mul_v2_v2(float r[2], const float a[2]);
 MINLINE void mul_v2_v2v2(float r[2], const float a[2], const float b[2]);
@@ -189,9 +192,12 @@ MINLINE float dot_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESU
 
 MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT;
 
+MINLINE double dot_v3v3_db(const double a[3], const double b[3]) ATTR_WARN_UNUSED_RESULT;
+
 MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;
 MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);
 MINLINE void cross_v3_v3v3_hi_prec(float r[3], const float a[3], const float b[3]);
+MINLINE void cross_v3_v3v3_db(double r[3], const double a[3], const double b[3]);
 
 MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]);
 
@@ -231,9 +237,11 @@ MINLINE double normalize_v3_d(double n[3]);
 /******************************* Interpolation *******************************/
 
 void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t);
+void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], const double t);
 void interp_v2_v2v2v2(
     float r[2], const float a[2], const float b[2], const float c[2], const float t[3]);
 void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t);
+void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], const double t);
 void interp_v3_v3v3v3(
     float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]);
 void interp_v3_v3v3v3v3(float p[3],
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 8f30255a08b..320f8a0f1ab 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -171,6 +171,11 @@ MINLINE float interpf(float target, float origin, float fac)
   return (fac * target) + (1.0f - fac) * origin;
 }
 
+MINLINE double interpd(double target, double origin, double fac)
+{
+  return (fac * target) + (1.0f - fac) * origin;
+}
+
 /* used for zoom values*/
 MINLINE float power_of_2(float val)
 {
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 7c64206134b..ffdd03d3568 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -71,6 +71,15 @@ void unit_m4(float m[4][4])
   m[3][0] = m[3][1] = m[3][2] = 0.0f;
 }
 
+void unit_m4_db(double m[4][4])
+{
+  m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0f;
+  m[0][1] = m[0][2] = m[0][3] = 0.0f;
+  m[1][0] = m[1][2] = m[1][3] = 0.0f;
+  m[2][0] = m[2][1] = m[2][3] = 0.0f;
+  m[3][0] = m[3][1] = m[3][2] = 0.0f;
+}
+
 void copy_m2_m2(float m1[2][2], const float m2[2][2])
 {
   memcpy(m1, m2, sizeof(float[2][2]));
@@ -87,6 +96,11 @@ void copy_m4_m4(float m1[4][4], const float m2[4][4])
   memcpy(m1, m2, sizeof(float[4][4]));
 }
 
+void copy_m4_m4_db(double m1[4][4], const double m2[4][4])
+{
+  memcpy(m1, m2, sizeof(double[4][4]));
+}
+
 void copy_m3_m4(float m1[3][3], const float m2[4][4])
 {
   m1[0][0] = m2[0][0];
@@ -127,6 +141,29 @@ void copy_m4_m3(float m1[4][4], const float m2[3][3]) /* no clear */
   m1[3][3] = 1.0f;
 }
 
+void copy_m4d_m4(double m1[4][4], const float m2[4][4])
+{
+  m1[0][0] = m2[0][0];
+  m1[0][1] = m2[0][1];
+  m1[0][2] = m2[0][2];
+  m1[0][3] = m2[0][3];
+
+  m1[1][0] = m2[1][0];
+  m1[1][1] = m2[1][1];
+  m1[1][2] = m2[1][2];
+  m1[1][3] = m2[1][3];
+
+  m1[2][0] = m2[2][0];
+  m1[2][1] = m2[2][1];
+  m1[2][2] = m2[2][2];
+  m1[2][3] = m2[2][3];
+
+  m1[3][0] = m2[3][0];
+  m1[3][1] = m2[3][1];
+  m1[3][2] = m2[3][2];
+  m1[3][3] = m2[3][3];
+}
+
 void copy_m3_m3d(float R[3][3], const double A[3][3])
 {
   /* Keep it stupid simple for better data flow in CPU. */
@@ -231,6 +268,61 @@ void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4])
 #endif
 }
 
+void mul_m4_m4m4_db_uniq(double R[4][4], const double A[4][4], const double B[4][4])
+{
+  BLI_assert(R != A && R != B);
+
+  /* matrix product: R[j][k] = A[j][i] . B[i][k] */
+
+  R[0][0] = B[0][0] * A[0][0] + B[0][1] * A[1][0] + B[0][2] * A[2][0] + B[0][3] * A[3][0];
+  R[0][1] = B[0][0] * A[0][1] + B[0][1] * A[1][1] + B[0][2] * A[2][1] + B[0][3] * A[3][1];
+  R[0][2] = B[0][0] * A[0][2] + B[0][1] * A[1][2] + B[0][2] * A[2][2] + B[0][3] * A[3][2];
+  R[0][3] = B[0][0] * A[0][3] + B[0][1] * A[1][3] + B[0][2] * A[2][3] + B[0][3] * A[3][3];
+
+  R[1][0] = B[1][0] * A[0][0] + B[1][1] * A[1][0] + B[1][2

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list