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_vec_types.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_vec_types.hh')
-rw-r--r--source/blender/blenlib/BLI_math_vec_types.hh11
1 files changed, 1 insertions, 10 deletions
diff --git a/source/blender/blenlib/BLI_math_vec_types.hh b/source/blender/blenlib/BLI_math_vec_types.hh
index 389307e331d..d9524eae746 100644
--- a/source/blender/blenlib/BLI_math_vec_types.hh
+++ b/source/blender/blenlib/BLI_math_vec_types.hh
@@ -321,7 +321,7 @@ template<typename T, int Size> struct vec_base : public vec_struct_base<T, Size>
BLI_VEC_OP_IMPL(ret, i, ret[i] = a[i] * b[i]);
}
- friend vec_base operator*(const vec_base &a, T b)
+ template<typename FactorT> friend vec_base operator*(const vec_base &a, FactorT b)
{
BLI_VEC_OP_IMPL(ret, i, ret[i] = a[i] * b);
}
@@ -579,13 +579,4 @@ using double2 = vec_base<double, 2>;
using double3 = vec_base<double, 3>;
using double4 = vec_base<double, 4>;
-template<typename T>
-inline constexpr bool is_math_float_type = (std::is_floating_point_v<T>
-#ifdef WITH_GMP
- || std::is_same_v<T, mpq_class>
-#endif
-);
-
-template<typename T> inline constexpr bool is_math_integral_type = std::is_integral_v<T>;
-
} // namespace blender