Cardinal splines

From JSXGraph Wiki
Jump to: navigation, search

The underlying JavaScript code

var brd = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-5, 5, 5, -5]}),
    p = [], c, i, tau;

for (i=0;i<5;i++) {
    p.push(brd.create('point', [(Math.random()-0.5)*7,(Math.random()-0.5)*7],{withLabel:true}));
}

// tension
tau = brd.create('slider', [[0.5,4],[4,3],[0.001,0.5,1]], {name:'tau'});
c = brd.create('curve', JXG.Math.Numerics.CardinalSpline(p, function(){ return tau.Value();}), {strokeWidth:3});