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>2014-09-16 09:41:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-09-16 09:41:17 +0400
commit775a54485b09526b806f6a327c2737dc4bde80a8 (patch)
tree9496fa43798ee9b6ac801213fbfc92e637df2976 /source/blender/blenlib
parent8b87b2473ae83c0a64115ce19ef1599513ce8acb (diff)
Math Lib: add mul_v3_project_m4_v3
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.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 0eac92c1db9..732f4b66f38 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -109,6 +109,7 @@ void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_m4_v4(float M[4][4], float r[4]);
void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);
void mul_project_m4_v3(float M[4][4], float vec[3]);
+void mul_v3_project_m4_v3(float r[3], float mat[4][4], const float vec[3]);
void mul_v2_project_m4_v3(float r[2], float M[4][4], const float vec[3]);
void mul_m3_v2(float m[3][3], float r[2]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 888587e055c..af42af88582 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -514,6 +514,16 @@ void mul_project_m4_v3(float mat[4][4], float vec[3])
vec[2] /= w;
}
+void mul_v3_project_m4_v3(float r[3], float mat[4][4], const float vec[3])
+{
+ const float w = mul_project_m4_v3_zfac(mat, vec);
+ mul_v3_m4v3(r, mat, vec);
+
+ r[0] /= w;
+ r[1] /= w;
+ r[2] /= w;
+}
+
void mul_v2_project_m4_v3(float r[2], float mat[4][4], const float vec[3])
{
const float w = mul_project_m4_v3_zfac(mat, vec);