summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-09-29 15:52:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-09-29 15:54:05 +0200
commit81e74c714f68d646009397ae7dca0bd3e7cd3fe5 (patch)
tree293b009d77d57feb1c7af93b8266cb4bd4d94916
parent4c754126e1a3eb477b10006d392aa4988db7c078 (diff)
spline: allow deazone + lerp
Issue: #1341
-rw-r--r--spline/spline.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 4c1ff389..917300c2 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -170,6 +170,16 @@ void spline::update_interp_data() const
for (unsigned k = 0; k <= max; k++)
data[k] = float(y * k / max); // no need for bresenham
}
+ else if (sz == 2 && list[0].y() < 1e-6)
+ {
+ unsigned start = std::clamp((unsigned)iround(list[0].x() * c), 1u, value_count-1);
+ unsigned end = std::clamp((unsigned)iround(list[1].x() * c), 2u, value_count-1);
+ unsigned max = end - start;
+ for (unsigned x = 0; x < start; x++)
+ data[x] = 0;
+ for (unsigned x = 0; x < max; x++)
+ data[start + x] = (float)(list[1].y() * x / max);
+ }
else
{
if (list[0].x() > 1e-2)