# set terminal svg size 600,400 dynamic enhanced font 'arial,10' mousing name "spline_5" butt dashlength 1.0 # set output 'spline.5.svg' set dummy t, y set grid nopolar set grid xtics nomxtics ytics nomytics noztics nomztics nortics nomrtics \ nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics set grid layerdefault lt 0 linecolor 0 linewidth 0.500, lt 0 linecolor 0 linewidth 0.500 set key fixed right top vertical Right noreverse enhanced autotitle box lt black linewidth 1.000 dashtype solid set arrow 1 from 0.00000, 1.00000, 0.00000 to 0.330000, 0.200000, 0.00000 nohead back nofilled linewidth 1.000 dashtype solid set arrow 2 from 0.330000, 0.200000, 0.00000 to 0.660000, 0.800000, 0.00000 nohead back nofilled linewidth 1.000 dashtype solid set arrow 3 from 0.660000, 0.800000, 0.00000 to 1.00000, 0.00000, 0.00000 nohead back nofilled linewidth 1.000 dashtype solid set parametric set style data lines set title "The cubic Bezier/Bspline basis functions in use" set trange [ 0.00000 : 1.00000 ] noreverse nowriteback set xrange [ 0.00000 : 1.00000 ] noreverse nowriteback set x2range [ * : * ] noreverse writeback set yrange [ -0.200000 : 1.40000 ] noreverse nowriteback set y2range [ * : * ] noreverse writeback set zrange [ * : * ] noreverse writeback set cbrange [ * : * ] noreverse writeback set rrange [ * : * ] noreverse writeback set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front noinvert bdefault m0(x) = 1 m1(x) = x m2(x) = x**2 m3(x) = x**3 h00(x) = x**2 * ( 2 * x - 3) + 1 h01(x) = -x**2 * (2 * x - 3) h10(x) = x * (x - 1)**2 h11(x) = x**2 * (x - 1) bez0(x) = (1 - x)**3 bez1(x) = 3 * (1 - x)**2 * x bez2(x) = 3 * (1 - x) * x**2 bez3(x) = x**3 bsp0(x) = ( 1 - 3 * x + 3 * x**2 - x**3 ) / 6 bsp1(x) = ( 4 - 6 * x**2 + 3 * x**3 ) / 6 bsp2(x) = ( 1 + 3 * x + 3 * x**2 - 3 * x**3 ) / 6 bsp3(x) = x**3 / 6 cub_bezier_x(t) = bez0(t) * x0 + bez1(t) * x1 + bez2(t) * x2 + bez3(t) * x3 cub_bezier_y(t) = bez0(t) * y0 + bez1(t) * y1 + bez2(t) * y2 + bez3(t) * y3 cub_bsplin_x(t) = bsp0(t) * x0 + bsp1(t) * x1 + bsp2(t) * x2 + bsp3(t) * x3 cub_bsplin_y(t) = bsp0(t) * y0 + bsp1(t) * y1 + bsp2(t) * y2 + bsp3(t) * y3 NO_ANIMATION = 1 y0 = 1 y1 = 0.2 y2 = 0.8 y3 = 0 x0 = 0 x1 = 0.33 x2 = 0.66 x3 = 1 xv0 = -0.3 yv0 = 0.5 xv1 = -0.4 yv1 = 0.2 plot cub_bezier_x(t), cub_bezier_y(t) with lines lt 2, cub_bsplin_x(t), cub_bsplin_y(t) with lines lt 3