From 748475b9431c5b09514b69b042f0daaea1231dc1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 14 Jun 2021 12:30:11 +0200 Subject: BLI_math: Cleanup: Use `mul_`/`madd_` functions. Better to avoid explicit vectors components direct manipulation when a generic operation for whole vector exists, if nothing else it avoids potential mistakes in indices. --- source/blender/blenlib/BLI_math_base.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib/BLI_math_base.h') diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 46219ad5493..5a3482db046 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -237,6 +237,7 @@ float ceil_power_of_10(float f); #ifndef NDEBUG /** \note 0.0001 is too small because normals may be converted from short's: see T34322. */ # define BLI_ASSERT_UNIT_EPSILON 0.0002f +# define BLI_ASSERT_UNIT_EPSILON_DB 0.0002 /** * \note Checks are flipped so NAN doesn't assert. * This is done because we're making sure the value was normalized and in the case we @@ -253,8 +254,8 @@ float ceil_power_of_10(float f); # define BLI_ASSERT_UNIT_V3_DB(v) \ { \ const double _test_unit = len_squared_v3_db(v); \ - BLI_assert(!(fabs(_test_unit - 1.0) >= BLI_ASSERT_UNIT_EPSILON) || \ - !(fabs(_test_unit) >= BLI_ASSERT_UNIT_EPSILON)); \ + BLI_assert(!(fabs(_test_unit - 1.0) >= BLI_ASSERT_UNIT_EPSILON_DB) || \ + !(fabs(_test_unit) >= BLI_ASSERT_UNIT_EPSILON_DB)); \ } \ (void)0 -- cgit v1.2.3