JSXGraph logo
JSXGraph
JSXGraph share

Share

Polynomial curve of constant width
QR code
<iframe 
    src="https://jsxgraph.uni-bayreuth.de/share/iframe/polynomial-curve-of-constant-width" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Polynomial curve of constant width" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-8, 8, 8, -8], keepaspectratio: true });
    board.suspendUpdate();
    var a = board.create('slider', [[-1, 6], [1, 6], [-5, 0.20, 8]], { name: 'a' });
    var b = board.create('slider', [[-1, 5], [1, 5], [-5, 1.15, 20]], { name: 'b' });
    var k = board.create('slider', [[-1, 4], [1, 4], [1, 1, 11]], { name: 'k\'', snapWidth: 1 });
    
    var c = board.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' });
    
    board.unsuspendUpdate();
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-8, 8, 8, -8], keepaspectratio: true });
board.suspendUpdate();
var a = board.create('slider', [[-1, 6], [1, 6], [-5, 0.20, 8]], { name: 'a' });
var b = board.create('slider', [[-1, 5], [1, 5], [-5, 1.15, 20]], { name: 'b' });
var k = board.create('slider', [[-1, 4], [1, 4], [1, 1, 11]], { name: 'k\'', snapWidth: 1 });

var c = board.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' });

board.unsuspendUpdate();
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Polynomial curve of constant width" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution ShareAlike 4.0 International License.
   https://creativecommons.org/licenses/by-sa/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-8, 8, 8, -8], keepaspectratio: true });
   board.suspendUpdate();
   var a = board.create('slider', [[-1, 6], [1, 6], [-5, 0.20, 8]], { name: 'a' });
   var b = board.create('slider', [[-1, 5], [1, 5], [-5, 1.15, 20]], { name: 'b' });
   var k = board.create('slider', [[-1, 4], [1, 4], [1, 1, 11]], { name: 'k\'', snapWidth: 1 });
   
   var c = board.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' });
   
   board.unsuspendUpdate();
</jsxgraph>

Polynomial curve of constant width

The curve with support defined by $$p(\phi)= a\cdot \cos^2(k\cdot\phi/2)+b$$ has constant width for odd values of $k$. It defines the parametric curve $$x(\phi) = p(\phi)\cos(\phi) - p'\sin(\phi)$$ $$y(\phi) = p(\phi)\sin(\phi) + p'\cos(\phi)$$ In the visualization with JSXGraph below $k$ is determined $$k = 2k'+1.$$
// Define the id of your board in BOARDID

var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-8, 8, 8, -8], keepaspectratio: true });
board.suspendUpdate();
var a = board.create('slider', [[-1, 6], [1, 6], [-5, 0.20, 8]], { name: 'a' });
var b = board.create('slider', [[-1, 5], [1, 5], [-5, 1.15, 20]], { name: 'b' });
var k = board.create('slider', [[-1, 4], [1, 4], [1, 1, 11]], { name: 'k\'', snapWidth: 1 });

var c = board.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' });

board.unsuspendUpdate();

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.