summaryrefslogtreecommitdiff
path: root/src/powermap.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2020-04-25 16:22:50 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2020-04-25 16:23:08 +0200
commit642ccefe86f51248b192e086a61ca665bbca3cfc (patch)
tree8e389d82bdb38e1088128e8acc546338642a96d3 /src/powermap.cc
parentc637d8630e6843c4677193da1ec5b2d7a60b6f07 (diff)
Avoid jumps of the function for avoiding monotonicity.
Diffstat (limited to 'src/powermap.cc')
-rw-r--r--src/powermap.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/powermap.cc b/src/powermap.cc
index e2d1bef..dff604f 100644
--- a/src/powermap.cc
+++ b/src/powermap.cc
@@ -208,10 +208,20 @@ void Powermap::updateSpline()
}
else {
auto const a2b2 = alpha*alpha + beta*beta;
- if (a2b2 > 9) {
+
+ // hard change to enforce monotonicity
+ // if (a2b2 > 9) {
+ // auto const tau = 3./sqrt(a2b2);
+ // m[i] = tau*alpha*deltas[i];
+ // m[i+1] = tau*alpha*deltas[i];
+ // }
+
+ // soft change to enforce monotonicity
+ if (a2b2 >= 4.5) {
+ auto const l = std::min(1., (a2b2-4.5)/4.5);
auto const tau = 3./sqrt(a2b2);
- m[i] = tau*alpha*deltas[i];
- m[i+1] = tau*alpha*deltas[i];
+ m[i] = (1-l)*m[i] + l*tau*alpha*deltas[i];
+ m[i+1] = (1-l)*m[i+1] + l*tau*alpha*deltas[i];
}
}
}