Catmull-Rom splines: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 19: Line 19:
c = brd.create('curve', JXG.Math.Numerics.CatmullRomSpline(p), {strokeWidth:3});
c = brd.create('curve', JXG.Math.Numerics.CatmullRomSpline(p), {strokeWidth:3});
</source>
</source>


[[Category:Examples]]
[[Category:Examples]]
[[Category:Curves]]
[[Category:Curves]]
[[Category:Interpolation]]
[[Category:Interpolation]]

Latest revision as of 21:50, 14 November 2020

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.CatmullRomSpline(p), {strokeWidth:3});