summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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];
}
}
}