diff options
author | YimingWu <xp8110@outlook.com> | 2019-08-20 16:09:55 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2019-08-20 16:09:55 +0300 |
commit | 8bee9af462238936087e0056d97cf086c2f7059a (patch) | |
tree | a103e0e42dccc788f5897782837093ce724e106d /source/blender/blenlib/intern/math_vector_inline.c | |
parent | a942d97b7971dc0e7add44e3e9ba1c02fb914f7d (diff) |
BLI: double version of some math functions.
Diffstat (limited to 'source/blender/blenlib/intern/math_vector_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 865c2f5dc25..8cb618ae14e 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -374,6 +374,13 @@ MINLINE void add_v3_v3(float r[3], const float a[3]) r[2] += a[2]; } +MINLINE void add_v3_v3_db(double r[3], const double a[3]) +{ + r[0] += a[0]; + r[1] += a[1]; + r[2] += a[2]; +} + MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]) { r[0] = a[0] + b[0]; @@ -450,6 +457,13 @@ MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], const int b[3]) r[2] = a[2] - b[2]; } +MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3]) +{ + r[0] = a[0] - b[0]; + r[1] = a[1] - b[1]; + r[2] = a[2] - b[2]; +} + MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3]) { r[0] = (double)a[0] - (double)b[0]; @@ -492,6 +506,13 @@ MINLINE void mul_v3_fl(float r[3], float f) r[2] *= f; } +MINLINE void mul_v3db_db(double r[3], double f) +{ + r[0] *= f; + r[1] *= f; + r[2] *= f; +} + MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f) { r[0] = a[0] * f; @@ -836,6 +857,11 @@ MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) return a[0] * (double)b[0] + a[1] * (double)b[1] + a[2] * (double)b[2]; } +MINLINE double dot_v3v3_db(const double a[3], const double b[3]) +{ + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; +} + MINLINE float cross_v2v2(const float a[2], const float b[2]) { return a[0] * b[1] - a[1] * b[0]; @@ -859,6 +885,14 @@ MINLINE void cross_v3_v3v3_hi_prec(float r[3], const float a[3], const float b[3 r[2] = (float)((double)a[0] * (double)b[1] - (double)a[1] * (double)b[0]); } +MINLINE void cross_v3_v3v3_db(double r[3], const double a[3], const double b[3]) +{ + BLI_assert(r != a && r != b); + r[0] = a[1] * b[2] - a[2] * b[1]; + r[1] = a[2] * b[0] - a[0] * b[2]; + r[2] = a[0] * b[1] - a[1] * b[0]; +} + /* Newell's Method */ /* excuse this fairly specific function, * its used for polygon normals all over the place |