diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-14 09:43:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-16 12:20:08 +0300 |
commit | 47a5d7d1bcad974dbeaf5e7f2945027e72835d34 (patch) | |
tree | 32cf780357e8997fbafd5078c69b193f431d2047 /source/blender/blenlib/intern/math_matrix.c | |
parent | ef515822ce9743483d5de67d53b02b8fad66e0ce (diff) |
BLI_math: Add double versions of functions
- mul_v3_m3v3_db
- mul_m3_v3_db
- negate_v3_db
Diffstat (limited to 'source/blender/blenlib/intern/math_matrix.c')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 0e3f905ef16..c9c61d5c878 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -587,6 +587,15 @@ void mul_v3_m3v3(float r[3], float M[3][3], const float a[3]) r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; } +void mul_v3_m3v3_db(double r[3], double M[3][3], const double a[3]) +{ + BLI_assert(r != a); + + r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; + r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; + r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; +} + void mul_v2_m3v3(float r[2], float M[3][3], const float a[3]) { BLI_assert(r != a); @@ -597,10 +606,12 @@ void mul_v2_m3v3(float r[2], float M[3][3], const float a[3]) void mul_m3_v3(float M[3][3], float r[3]) { - float tmp[3]; + mul_v3_m3v3(r, M, (const float[3]){UNPACK3(r)}); +} - mul_v3_m3v3(tmp, M, r); - copy_v3_v3(r, tmp); +void mul_m3_v3_db(double M[3][3], double r[3]) +{ + mul_v3_m3v3_db(r, M, (const double[3]){UNPACK3(r)}); } void mul_transposed_m3_v3(float mat[3][3], float vec[3]) |