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:
authorHans Goudey <h.goudey@me.com>2022-03-25 17:57:10 +0300
committerHans Goudey <h.goudey@me.com>2022-03-25 17:57:10 +0300
commit378022c7973db54f1ad8cf335a9359c3bf27ddb5 (patch)
treea69090518a1f7c0ca7661b370dedd05ee37f6b52 /source/blender/blenlib/BLI_math_vector.hh
parent1243cb803e7d096d27e2b5dcdfa05bf0367e248c (diff)
BLI: Adjust interpolation to support integers, other tweaks
In order to allow interpolation of integers with a float, add a separate template parameter for the factor and multiplication types. Also move some helper constexpr variables to the "base" header (reversing the dependency to "base" -> "vector"). This also adds a distance function for scalar types, which is helpful to allow sharing code between vectors and basic types. Differential Revision: https://developer.blender.org/D14446
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.hh')
-rw-r--r--source/blender/blenlib/BLI_math_vector.hh6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.hh b/source/blender/blenlib/BLI_math_vector.hh
index b1a3242ae52..b9f0939674e 100644
--- a/source/blender/blenlib/BLI_math_vector.hh
+++ b/source/blender/blenlib/BLI_math_vector.hh
@@ -10,7 +10,7 @@
#include <cmath>
#include <type_traits>
-#include "BLI_math_base_safe.h"
+#include "BLI_math_base.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_span.hh"
#include "BLI_utildefines.h"
@@ -339,10 +339,10 @@ inline vec_base<T, 3> cross_poly(Span<vec_base<T, 3>> poly)
return n;
}
-template<typename T, int Size, BLI_ENABLE_IF((is_math_float_type<T>))>
+template<typename T, typename FactorT, int Size, BLI_ENABLE_IF((is_math_float_type<FactorT>))>
inline vec_base<T, Size> interpolate(const vec_base<T, Size> &a,
const vec_base<T, Size> &b,
- const T &t)
+ const FactorT &t)
{
return a * (1 - t) + b * t;
}