#!/users/mgd/packages/swarm/blt2.3/bin/bltwish
#!../bltwish

source bltDemo.tcl

option add *graph.elemScaleSymbols true

# test to show spline over-shooting

set tcl_precision 15

# Make and fill small vectors
vector a(10) b(10)

for {set i 10} {$i > 0} {incr i -1} {
    set a($i-1) [expr $i*$i]
    set b($i-1) [expr sin($i*$i*$i)]
}
a sort b

vector c d e

# make and fill (x only) large vectors
a populate c 10

# natural spline interpolation
spline natural a b c d

# quadratic spline interpolation
spline quadratic a b c e -error 0.0

# make plot
graph .graph 
.graph xaxis configure -title "x^2" 
.graph yaxis configure -title "sin(y^3)"

.graph element create Original -x a -y b \
    -color red4 \
    -fill red \
    -pixels 5 \
    -symbol circle -smooth natural

# .graph element create Natural -x c -y d \
    -color green4 \
    -fill green \
    -pixels 3 \
    -symbol triangle

# .graph element create Quadratic -x c -y e \
    -color blue4 \
    -fill orange2 \
    -pixels 3 \
    -symbol diamond 

table . .graph -fill both

Blt_ZoomStack .graph
Blt_Crosshairs .graph
Blt_ActiveLegend .graph
Blt_ClosestPoint .graph
Blt_PrintKey .graph

