JSXGraph logo
JSXGraph
JSXGraph share

Share

Reuleaux pentagon
QR code
<iframe 
    src="http://jsxgraph.uni-bayreuth.de/share/iframe/reuleaux-pentagon" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Reuleaux pentagon" 
    allowfullscreen
></iframe>
This code has to
<input type="button" value="start" onclick="start();">
<input type="button" value="stop" onclick="stop();">
<input type="button" value="one step" onclick="rol5.rolling();rol3.rolling();">

<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: [-5, 7, 5, -3], keepaspectratio: true });
    board.renderer.container.style.backgroundColor = '#3d1c24'; // background color board
    
    board.suspendUpdate();
    // Pentagon
    var A = board.create('point', [-2, -2]);
    var B = board.create('point', [2, -2]);
    var pol5 = board.create('regularpolygon', [A, B, 5], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
        fillOpacity: 0.0 });
    for (var i = 0; i < 5; i++) pol5.vertices[i].setAttribute({ color: '#3d1c24' });
    
    var diagPentagon = (1 + Math.sqrt(5)) * 0.5 * A.Dist(B);
    
    // Triangle
    var C = board.create('point', [-2, -2]);
    var D = board.create('point', [C.X() + 3 / 5 * diagPentagon, C.Y()]);
    var pol3 = board.create('regularpolygon', [C, D, 3], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
        fillOpacity: 0.0 });
    for (i = 0; i < 3; i++) pol3.vertices[i].setAttribute({ color: '#3d1c24' });
    
    // Heptagon
    var E = board.create('point', [-2, -2]);
    
    //
    // Side length of the heptagon depending on the diagonal of the pentagon:
    // r_7 = 7/5*r_5
    var diagHeptagon = 7 / 5 * diagPentagon;
    // s_7 = r_7*sqrt(2)*sqrt(1-cos(pi/7)) (law of cosines)
    var sideHeptagon = Math.sqrt(2 * (1 - Math.cos(Math.PI / 7))) * diagHeptagon;
    // 
    var F = board.create('point', [E.X() + sideHeptagon, E.Y()]);
    var pol7 = board.create('regularpolygon', [E, F, 7], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
        fillOpacity: 0.0 });
    for (i = 0; i < 7; i++) pol7.vertices[i].setAttribute({ color: '#3d1c24' });
    
    // Create the Reuleauc curves
    var reuleauxHeptagon = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol7.vertices, 7), { strokeWidth: 6,
        strokeColor: '#d66d55', fillColor: '#d6bb55', highlightFillColor: '#d6bb55' });
    var reuleauxPentagon = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol5.vertices, 5), { strokeWidth: 6,
        strokeColor: '#d66d55', fillColor: '#ad5544', highlightFillColor: '#ad5544' });
    var reuleauxTriangle = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3), { strokeWidth: 6,
        strokeColor: '#d66d55', fillColor: '#703545', highlightFillColor: '#703545' });
    board.unsuspendUpdate();
    
    var rol5 = board.createRoulette(reuleauxHeptagon, reuleauxPentagon, 6 * Math.PI / 5, Math.PI / 45, 1, 50, [A, B, C, D]);
    var rol3 = board.createRoulette(reuleauxPentagon, reuleauxTriangle, 6 * Math.PI / 5, Math.PI / 45, -1, 50, [C, D]);
    var rollIt = function() {
        rol5.rolling();
        rol3.rolling();
    };
    var interval;
    var start = function() {
        interval = setInterval(rollIt, 10);
    };
    var stop = function() {
        clearInterval(interval);
    }
 </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: [-5, 7, 5, -3], keepaspectratio: true });
board.renderer.container.style.backgroundColor = '#3d1c24'; // background color board

board.suspendUpdate();
// Pentagon
var A = board.create('point', [-2, -2]);
var B = board.create('point', [2, -2]);
var pol5 = board.create('regularpolygon', [A, B, 5], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
    fillOpacity: 0.0 });
for (var i = 0; i < 5; i++) pol5.vertices[i].setAttribute({ color: '#3d1c24' });

var diagPentagon = (1 + Math.sqrt(5)) * 0.5 * A.Dist(B);

// Triangle
var C = board.create('point', [-2, -2]);
var D = board.create('point', [C.X() + 3 / 5 * diagPentagon, C.Y()]);
var pol3 = board.create('regularpolygon', [C, D, 3], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
    fillOpacity: 0.0 });
for (i = 0; i < 3; i++) pol3.vertices[i].setAttribute({ color: '#3d1c24' });

// Heptagon
var E = board.create('point', [-2, -2]);

//
// Side length of the heptagon depending on the diagonal of the pentagon:
// r_7 = 7/5*r_5
var diagHeptagon = 7 / 5 * diagPentagon;
// s_7 = r_7*sqrt(2)*sqrt(1-cos(pi/7)) (law of cosines)
var sideHeptagon = Math.sqrt(2 * (1 - Math.cos(Math.PI / 7))) * diagHeptagon;
// 
var F = board.create('point', [E.X() + sideHeptagon, E.Y()]);
var pol7 = board.create('regularpolygon', [E, F, 7], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
    fillOpacity: 0.0 });
for (i = 0; i < 7; i++) pol7.vertices[i].setAttribute({ color: '#3d1c24' });

// Create the Reuleauc curves
var reuleauxHeptagon = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol7.vertices, 7), { strokeWidth: 6,
    strokeColor: '#d66d55', fillColor: '#d6bb55', highlightFillColor: '#d6bb55' });
var reuleauxPentagon = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol5.vertices, 5), { strokeWidth: 6,
    strokeColor: '#d66d55', fillColor: '#ad5544', highlightFillColor: '#ad5544' });
var reuleauxTriangle = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3), { strokeWidth: 6,
    strokeColor: '#d66d55', fillColor: '#703545', highlightFillColor: '#703545' });
board.unsuspendUpdate();

var rol5 = board.createRoulette(reuleauxHeptagon, reuleauxPentagon, 6 * Math.PI / 5, Math.PI / 45, 1, 50, [A, B, C, D]);
var rol3 = board.createRoulette(reuleauxPentagon, reuleauxTriangle, 6 * Math.PI / 5, Math.PI / 45, -1, 50, [C, D]);
var rollIt = function() {
    rol5.rolling();
    rol3.rolling();
};
var interval;
var start = function() {
    interval = setInterval(rollIt, 10);
};
var stop = function() {
    clearInterval(interval);
}

Reuleaux pentagon

This code creates a dark-themed board displaying three hidden regular polygons—a triangle, a pentagon, and a heptagon—on which colored Reuleaux curves are drawn. The code then animates rolling interactions between the curves, simulating continuous motion along each shape. **AI generated desctiption**
<input type="button" value="start" onclick="start();">
<input type="button" value="stop" onclick="stop();">
<input type="button" value="one step" onclick="rol5.rolling();rol3.rolling();">
// Define the id of your board in BOARDID

var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-5, 7, 5, -3], keepaspectratio: true });
board.renderer.container.style.backgroundColor = '#3d1c24'; // background color board

board.suspendUpdate();
// Pentagon
var A = board.create('point', [-2, -2]);
var B = board.create('point', [2, -2]);
var pol5 = board.create('regularpolygon', [A, B, 5], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
    fillOpacity: 0.0 });
for (var i = 0; i < 5; i++) pol5.vertices[i].setAttribute({ color: '#3d1c24' });

var diagPentagon = (1 + Math.sqrt(5)) * 0.5 * A.Dist(B);

// Triangle
var C = board.create('point', [-2, -2]);
var D = board.create('point', [C.X() + 3 / 5 * diagPentagon, C.Y()]);
var pol3 = board.create('regularpolygon', [C, D, 3], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
    fillOpacity: 0.0 });
for (i = 0; i < 3; i++) pol3.vertices[i].setAttribute({ color: '#3d1c24' });

// Heptagon
var E = board.create('point', [-2, -2]);

//
// Side length of the heptagon depending on the diagonal of the pentagon:
// r_7 = 7/5*r_5
var diagHeptagon = 7 / 5 * diagPentagon;
// s_7 = r_7*sqrt(2)*sqrt(1-cos(pi/7)) (law of cosines)
var sideHeptagon = Math.sqrt(2 * (1 - Math.cos(Math.PI / 7))) * diagHeptagon;
// 
var F = board.create('point', [E.X() + sideHeptagon, E.Y()]);
var pol7 = board.create('regularpolygon', [E, F, 7], { withLines: false, fillColor: 'none', highlightFillColor: 'none',
    fillOpacity: 0.0 });
for (i = 0; i < 7; i++) pol7.vertices[i].setAttribute({ color: '#3d1c24' });

// Create the Reuleauc curves
var reuleauxHeptagon = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol7.vertices, 7), { strokeWidth: 6,
    strokeColor: '#d66d55', fillColor: '#d6bb55', highlightFillColor: '#d6bb55' });
var reuleauxPentagon = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol5.vertices, 5), { strokeWidth: 6,
    strokeColor: '#d66d55', fillColor: '#ad5544', highlightFillColor: '#ad5544' });
var reuleauxTriangle = board.create('curve', JXG.Math.Geometry.reuleauxPolygon(pol3.vertices, 3), { strokeWidth: 6,
    strokeColor: '#d66d55', fillColor: '#703545', highlightFillColor: '#703545' });
board.unsuspendUpdate();

var rol5 = board.createRoulette(reuleauxHeptagon, reuleauxPentagon, 6 * Math.PI / 5, Math.PI / 45, 1, 50, [A, B, C, D]);
var rol3 = board.createRoulette(reuleauxPentagon, reuleauxTriangle, 6 * Math.PI / 5, Math.PI / 45, -1, 50, [C, D]);
var rollIt = function() {
    rol5.rolling();
    rol3.rolling();
};
var interval;
var start = function() {
    interval = setInterval(rollIt, 10);
};
var stop = function() {
    clearInterval(interval);
}

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.