OpenGTA/tests/plot_interpolate.sh
Anonymous Maarten 1ae34ae340 2007-06-14
2015-12-03 01:38:22 +01:00

44 lines
505 B
Bash

#!/bin/bash
function input_data() {
cat <<EOF
0
1
2
1
0
-1
-2
-1
0
1
2
1
0
-1
-2
-1
0
EOF
}
function transform() {
switch=$1
input_data | ./interpolate_test --$switch >gnuplot_data.$$
cat <<EOF >gnuplot_script.$$
plot "gnuplot_data.$$" title "$switch"
EOF
gnuplot gnuplot_script.$$ -
}
if [ ! -f interpolate_test ]; then
g++ -I ../math -o interpolate_test interpolate_test.cpp
fi
transform linear
transform cubic
transform cosine
transform hermite
rm -f gnuplot_data.$$ gnuplot_script.$$