From 971250070e7b27590d215de54116f3990ab8ff5a Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 2 Mar 2026 21:10:46 +0100 Subject: Adding bluring for masks --- lib/core/c++/math/n_linear.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lib/core/c++/math/n_linear.hpp (limited to 'lib/core/c++/math') diff --git a/lib/core/c++/math/n_linear.hpp b/lib/core/c++/math/n_linear.hpp new file mode 100644 index 0000000..62906cd --- /dev/null +++ b/lib/core/c++/math/n_linear.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "../common.hpp" + +namespace kel { +namespace lbm { + +template +void n_linear_interpolate(const saw::data& field, const saw::data>& pos){ + + auto pos_bound = pos; + auto meta = field.dims(); + saw::data ind; + for(saw::data i{0u}; i < saw::data{D}; ++i){ + pos_bound.at(i).set( + std::max( + std::min( + meta.at(i).template cast_to().get(), + pos.at(i).get() + 1.5 + ), + 1, + ) + -1 + ); + ind.at(i) = pos_bound.at(i).template cast_to(); + } +} +} +} -- cgit v1.2.3