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:
authorBastien Montagne <bastien@blender.org>2021-06-14 12:06:35 +0300
committerBastien Montagne <bastien@blender.org>2021-06-14 13:32:38 +0300
commitb21db5e6988566dc3344b3293eb7e33234ec2597 (patch)
tree0bc664e2dfb2dce5b94062367ba54bc14eacb9bf /source/blender/blenlib/intern/math_vector_inline.c
parent5add6f2ed93773e1231e3d52dc9fd963b3bfb9e7 (diff)
BLI_math: Fix several division-by-zero cases.
Those were caused by various tools used on degenerate geometry, see T79775. Note that fixes are as low-level as possible, to ensure they cover as much as possible of unreported issues too. We still probably have many more of those hidden in BLI_math though.
Diffstat (limited to 'source/blender/blenlib/intern/math_vector_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index ead354c2d87..e0df9665a7e 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -1282,6 +1282,21 @@ MINLINE bool is_zero_v4(const float v[4])
return (v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f && v[3] == 0.0f);
}
+MINLINE bool is_zero_v2_db(const double v[2])
+{
+ return (v[0] == 0.0 && v[1] == 0.0);
+}
+
+MINLINE bool is_zero_v3_db(const double v[3])
+{
+ return (v[0] == 0.0 && v[1] == 0.0 && v[2] == 0.0);
+}
+
+MINLINE bool is_zero_v4_db(const double v[4])
+{
+ return (v[0] == 0.0 && v[1] == 0.0 && v[2] == 0.0 && v[3] == 0.0);
+}
+
MINLINE bool is_one_v3(const float v[3])
{
return (v[0] == 1.0f && v[1] == 1.0f && v[2] == 1.0f);