Polynomial curve of constant width: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The curve defined by | The curve with support defined by | ||
:<math> p(\phi) = a\cdot cos(k\cdot\phi/2)+b </math> | :<math> p(\phi)= a\cdot \cos^2(k\cdot\phi/2)+b </math> | ||
has constant width for odd values of <math>k</math>. | |||
In the | It defines the parametric curve | ||
:<math> x(\phi) = p(\phi)\cos(\phi) - p'\sin(\phi)</math> | |||
:<math> y(\phi) = p(\phi)\sin(\phi) + p'\cos(\phi)</math> | |||
In the visualization with JSXGraph below <math>k</math> is determined | |||
:<math>k = 2k'+1.</math> | :<math>k = 2k'+1.</math> | ||
Line 10: | Line 16: | ||
<jsxgraph width="600" height="600"> | <jsxgraph width="600" height="600"> | ||
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[- | var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-8,8,8,-8], keepaspectratio:true}); | ||
brd.suspendUpdate(); | brd.suspendUpdate(); | ||
var a = brd.create('slider',[[-1, | var a = brd.create('slider',[[-1,6],[1,6],[-5,0.20,8]], {name:'a'}); | ||
var b = brd.create('slider',[[-1, | var b = brd.create('slider',[[-1,5],[1,5],[-5,1.15,20]], {name:'b'}); | ||
var k = brd.create('slider',[[-1, | var k = brd.create('slider',[[-1,4],[1,4],[1,1,11]], {name:'k\'', snapWidth:1}); | ||
var | var c = brd.create('curve',[function(phi){ | ||
var kk, aa, bb, p, ps, co, si; | var kk, aa, bb, p, ps, co, si; | ||
aa = a.Value(); | |||
bb = b.Value(); | |||
kk = 2*k.Value()+1; | |||
co = Math.cos(kk*phi*0.5); | co = Math.cos(kk*phi*0.5); | ||
si = Math.sin(kk*phi*0.5); | si = Math.sin(kk*phi*0.5); | ||
p = aa*co*co+bb; | p = aa*co*co+bb; | ||
ps = -kk*co*si; | ps = -aa*kk*co*si; | ||
return p*Math.cos(phi)-ps*Math.sin(phi); | return p*Math.cos(phi)-ps*Math.sin(phi); | ||
}, | }, | ||
function(phi | function(phi){ | ||
var kk, aa, bb, p, ps, co, si; | var kk, aa, bb, p, ps, co, si; | ||
aa = a.Value(); | |||
bb = b.Value(); | |||
kk = 2*k.Value()+1; | |||
co = Math.cos(kk*phi*0.5); | co = Math.cos(kk*phi*0.5); | ||
si = Math.sin(kk*phi*0.5); | si = Math.sin(kk*phi*0.5); | ||
p = aa*co*co+bb; | p = aa*co*co+bb; | ||
ps = -kk*co*si; | ps = -aa*kk*co*si; | ||
return p*Math.sin(phi)+ps*Math. | return p*Math.sin(phi)+ps*Math.cos(phi); | ||
}, | }, | ||
0, Math.PI*2], {strokeWidth:10, strokeColor:'#ad5544'}); | 0, Math.PI*2], {strokeWidth:10, strokeColor:'#ad5544'}); | ||
Line 65: | Line 55: | ||
===The underlying JavaScript code=== | ===The underlying JavaScript code=== | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[- | var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-8,8,8,-8], keepaspectratio:true}); | ||
brd.suspendUpdate(); | brd.suspendUpdate(); | ||
var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,0.20,5]], {name:'a'}); | var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,0.20,5]], {name:'a'}); | ||
Line 71: | Line 61: | ||
var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,1,11]], {name:'k\'', snapWidth:1}); | var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,1,11]], {name:'k\'', snapWidth:1}); | ||
var | var c = brd.create('curve',[function(phi){ | ||
var kk, aa, bb; | var kk, aa, bb, p, ps, co, si; | ||
aa = a.Value(); | |||
bb = b.Value(); | |||
kk = 2*k.Value()+1; | |||
co = Math.cos(kk*phi*0.5); | |||
si = Math.sin(kk*phi*0.5); | |||
p = aa*co*co+bb; | |||
ps = -aa*kk*co*si; | |||
}, | return p*Math.cos(phi)-ps*Math.sin(phi); | ||
}, | |||
function(phi){ | |||
var kk, aa, bb, p, ps, co, si; | |||
aa = a.Value(); | |||
bb = b.Value(); | |||
kk = 2*k.Value()+1; | |||
co = Math.cos(kk*phi*0.5); | |||
si = Math.sin(kk*phi*0.5); | |||
p = aa*co*co+bb; | |||
ps = -aa*kk*co*si; | |||
return p*Math.sin(phi)+ps*Math.cos(phi); | |||
}, | |||
0, Math.PI*2], {strokeWidth:10, strokeColor:'#ad5544'}); | |||
brd.unsuspendUpdate(); | brd.unsuspendUpdate(); | ||
</source> | </source> |
Latest revision as of 20:51, 23 March 2021
The curve with support defined by
- [math]\displaystyle{ p(\phi)= a\cdot \cos^2(k\cdot\phi/2)+b }[/math]
has constant width for odd values of [math]\displaystyle{ k }[/math]. It defines the parametric curve
- [math]\displaystyle{ x(\phi) = p(\phi)\cos(\phi) - p'\sin(\phi) }[/math]
- [math]\displaystyle{ y(\phi) = p(\phi)\sin(\phi) + p'\cos(\phi) }[/math]
In the visualization with JSXGraph below [math]\displaystyle{ k }[/math] is determined
- [math]\displaystyle{ k = 2k'+1. }[/math]
References
The underlying JavaScript code
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-8,8,8,-8], keepaspectratio:true});
brd.suspendUpdate();
var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,0.20,5]], {name:'a'});
var b = brd.create('slider',[[-1,1.6],[1,1.6],[-5,1.15,10]], {name:'b'});
var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,1,11]], {name:'k\'', snapWidth:1});
var c = brd.create('curve',[function(phi){
var kk, aa, bb, p, ps, co, si;
aa = a.Value();
bb = b.Value();
kk = 2*k.Value()+1;
co = Math.cos(kk*phi*0.5);
si = Math.sin(kk*phi*0.5);
p = aa*co*co+bb;
ps = -aa*kk*co*si;
return p*Math.cos(phi)-ps*Math.sin(phi);
},
function(phi){
var kk, aa, bb, p, ps, co, si;
aa = a.Value();
bb = b.Value();
kk = 2*k.Value()+1;
co = Math.cos(kk*phi*0.5);
si = Math.sin(kk*phi*0.5);
p = aa*co*co+bb;
ps = -aa*kk*co*si;
return p*Math.sin(phi)+ps*Math.cos(phi);
},
0, Math.PI*2], {strokeWidth:10, strokeColor:'#ad5544'});
brd.unsuspendUpdate();