Cardinal splines

From JSXGraph Wiki
Revision as of 07:53, 10 April 2014 by A WASSERMANN (talk | contribs) (Created page with "jsxgraph width="400" height="400" box="box"> var brd = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-5, 5, 5, -5]}), p = [], c, i, tau; for (i=0;i<5;i++) { p....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

jsxgraph width="400" height="400" box="box"> 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}));

}

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

The underlying JavaScript code

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

for (i=0;i<5;i++) {
    p.push(brd.create('point', [(Math.random()-0.5)*7,(Math.random()-0.5)*7],{withLabel:true}));
}
c = brd.create('curve', JXG.Math.Numerics.CardinalSpline(p, function(){ return tau.Value();}), {strokeWidth:3});