summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-06 15:49:37 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-06 15:49:37 +0200
commitc1b32648d45e57282e26cf0b07f4b7bd23133c57 (patch)
tree489798242f3300ed3e0c08b5990714f07bed18db /test
parentdemo tension parameter (diff)
downloadblueshift-c1b32648d45e57282e26cf0b07f4b7bd23133c57.tar.gz
blueshift-c1b32648d45e57282e26cf0b07f4b7bd23133c57.tar.bz2
blueshift-c1b32648d45e57282e26cf0b07f4b7bd23133c57.tar.xz
add monotone cubic interpolation
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/monotone_cubic_interpolation6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/monotone_cubic_interpolation b/test/monotone_cubic_interpolation
index 4ade1dc..a659dcd 100755
--- a/test/monotone_cubic_interpolation
+++ b/test/monotone_cubic_interpolation
@@ -21,7 +21,7 @@
# using the Fritsch–Carlson method.
# Does not overshoot, but regular
# cubic interpolation with linear
-# replace for overshots is better.
+# replacement for overshots is better.
# Load matplotlib.pyplot,
@@ -87,7 +87,7 @@ def interpolate(small, tension = 0):
large = [None] * len(small) ** 2
small_, large_ = len(small) - 1, len(large) - 1
# Basis functions
- h00 = lambda t : (1 + 2 * t) * (1 - t) ** 2
+ #h00 = lambda t : (1 + 2 * t) * (1 - t) ** 2
h10 = lambda t : t * (1 - t) ** 2
h01 = lambda t : t ** 2 * (3 - 2 * t)
h11 = lambda t : t ** 2 * (t - 1)
@@ -132,7 +132,7 @@ def interpolate(small, tension = 0):
# Tangents
mj, mk = c_ * ms[j], c_ * ms[k]
# Interpolation
- large[i] = h00(w) * pj + h10(w) * mj + h01(w) * pk + h11(w) * mk
+ large[i] = pj + h10(w) * mj + h01(w) * (pk - pj) + h11(w) * mk
return large
# Plot interpolation