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:
authorJacques Lucke <jacques@blender.org>2022-05-30 11:14:00 +0300
committerJacques Lucke <jacques@blender.org>2022-05-30 11:14:00 +0300
commitfc3c589b18080640d483ed91c5be6efb945fc4c3 (patch)
tree766cc0f4b3a5f87cdbceb8d002454e91b8ca4f6b /source/blender/blenlib
parent16746e8ec2831937771daf488b1c2fd444dbd8dd (diff)
parenta7bda30ca890d1a76b1a1f0be23cb08a4bd1b5f5 (diff)
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_vector.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.hh b/source/blender/blenlib/BLI_math_vector.hh
index b9f0939674e..7983bbccb35 100644
--- a/source/blender/blenlib/BLI_math_vector.hh
+++ b/source/blender/blenlib/BLI_math_vector.hh
@@ -49,6 +49,20 @@ template<typename T, int Size> inline bool is_any_zero(const vec_base<T, Size> &
return false;
}
+template<typename T, int Size>
+inline bool almost_equal_relative(const vec_base<T, Size> &a,
+ const vec_base<T, Size> &b,
+ const T &epsilon_factor)
+{
+ for (int i = 0; i < Size; i++) {
+ const float epsilon = epsilon_factor * math::abs(a[i]);
+ if (math::distance(a[i], b[i]) > epsilon) {
+ return false;
+ }
+ }
+ return true;
+}
+
template<typename T, int Size> inline vec_base<T, Size> abs(const vec_base<T, Size> &a)
{
vec_base<T, Size> result;