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.h5
-rw-r--r--source/blender/blenlib/intern/math_matrix.c19
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 328b5614f52..de4bd203eb6 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -103,6 +103,11 @@ int invert_m3_m3(float R[3][3], float A[3][3]);
int invert_m4(float R[4][4]);
int invert_m4_m4(float R[4][4], float A[4][4]);
+/* double ariphmetics */
+void mul_m4_v4d(float M[4][4], double r[4]);
+void mul_v4d_m4v4d(double r[4], float M[4][4], double v[4]);
+
+
/****************************** Linear Algebra *******************************/
void transpose_m3(float R[3][3]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 69e4102b497..b777b394005 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -373,6 +373,25 @@ void mul_m4_v4(float mat[4][4], float r[4])
mul_v4_m4v4(r, mat, r);
}
+void mul_v4d_m4v4d(double r[4], float mat[4][4], double v[4])
+{
+ double x, y, z;
+
+ x= v[0];
+ y= v[1];
+ z= v[2];
+
+ r[0]= x*(double)mat[0][0] + y*(double)mat[1][0] + z*(double)mat[2][0] + (double)mat[3][0]*v[3];
+ r[1]= x*(double)mat[0][1] + y*(double)mat[1][1] + z*(double)mat[2][1] + (double)mat[3][1]*v[3];
+ r[2]= x*(double)mat[0][2] + y*(double)mat[1][2] + z*(double)mat[2][2] + (double)mat[3][2]*v[3];
+ r[3]= x*(double)mat[0][3] + y*(double)mat[1][3] + z*(double)mat[2][3] + (double)mat[3][3]*v[3];
+}
+
+void mul_m4_v4d(float mat[4][4], double r[4])
+{
+ mul_v4d_m4v4d(r, mat, r);
+}
+
void mul_v3_m3v3(float r[3], float M[3][3], float a[3])
{
r[0]= M[0][0]*a[0] + M[1][0]*a[1] + M[2][0]*a[2];