Polynomial curve of constant width: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
<jsxgraph width="600" height="600">
<jsxgraph width="600" height="600">
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,2,2,-2], keepaspectratio:true});
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,2,2,-2], keepaspectratio:true});
var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,1,5]], {name:'a'});
brd.suspendUpdate();
var b = brd.create('slider',[[-1,1.6],[1,1.6],[-5,1,5]], {name:'b'});
var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,2,5]], {name:'a'});
var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,1,11]], {name:'k', snapWidth:1});
var b = brd.create('slider',[[-1,1.6],[1,1.6],[-5,8,10]], {name:'b'});
var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,3,11]], {name:'k', snapWidth:1});


var p = brd.create('curve',[function(phi, suspendUpdate){  
var p = brd.create('curve',[function(phi, suspendUpdate){  
Line 14: Line 15:
                               var co = Math.cos(kk*phi*0.5);
                               var co = Math.cos(kk*phi*0.5);
                               return aa*co*co+bb;
                               return aa*co*co+bb;
                             },[0,0], 0,Math.PI*2], {curveType:'polar'});
                             },[0,0], 0,Math.PI*2], {curveType:'polar', strokeWidth:6, strokeColor:'#3d1c24'});
brd.unsuspendUpdate();
</jsxgraph>
</jsxgraph>


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

Revision as of 12:57, 6 October 2010