JSXGraph logo
JSXGraph
JSXGraph share

Share

Rolling circle on circle
QR code
<iframe 
    src="https://jsxgraph.org/share/iframe/rolling-circle-on-circle" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Rolling circle on circle" 
    allowfullscreen
></iframe>
This code has to
<input type="button" value="start" onclick="rol.start()">
<input type="button" value="stop" onclick="rol.stop()">
<input type="button" value="one step" onclick="rol.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, 5, 5, -5], keepaspectratio: true });
    board.suspendUpdate();
    // Big circle
    var bigCircle = board.create('curve', [
                function(t) { return 4 * Math.cos(t); }, function(t) { return 4 * Math.sin(t); }, 0, 2 * Math.PI], { strokeWidth: 6 });
    // Circle
    var P = board.create('point', [4, 0], { name: 'P', trace: false });
    var C = board.create('point', [2, 0], { name: 'C' });
    var circle = board.create('curve', [
                        function(t) {
            var d = P.Dist(C),
                beta = JXG.Math.Geometry.rad([C.X() + 1, C.Y()], C, P);
            t += beta;
            return C.X() + d * Math.cos(t);
                        },
                        function(t) {
            var d = P.Dist(C),
                beta = JXG.Math.Geometry.rad([C.X() + 1, C.Y()], C, P);
            t += beta;
            return C.Y() + d * Math.sin(t);
                        },
                        0, 2 * Math.PI], { strokeWidth: 6, strokeColor: 'green' });
    
    // Point on circle
    var B = board.create('glider', [0, 2, circle], { name: 'B', color: 'blue', trace: false });
    board.create('segment', [C, B], { color: 'black' });
    board.unsuspendUpdate();
    var rol = board.createRoulette(bigCircle, circle, 0, Math.PI / 45, -1, 150, [C, P, B]);
 </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, 5, 5, -5], keepaspectratio: true });
board.suspendUpdate();
// Big circle
var bigCircle = board.create('curve', [
            function(t) { return 4 * Math.cos(t); }, function(t) { return 4 * Math.sin(t); }, 0, 2 * Math.PI], { strokeWidth: 6 });
// Circle
var P = board.create('point', [4, 0], { name: 'P', trace: false });
var C = board.create('point', [2, 0], { name: 'C' });
var circle = board.create('curve', [
                    function(t) {
        var d = P.Dist(C),
            beta = JXG.Math.Geometry.rad([C.X() + 1, C.Y()], C, P);
        t += beta;
        return C.X() + d * Math.cos(t);
                    },
                    function(t) {
        var d = P.Dist(C),
            beta = JXG.Math.Geometry.rad([C.X() + 1, C.Y()], C, P);
        t += beta;
        return C.Y() + d * Math.sin(t);
                    },
                    0, 2 * Math.PI], { strokeWidth: 6, strokeColor: 'green' });

// Point on circle
var B = board.create('glider', [0, 2, circle], { name: 'B', color: 'blue', trace: false });
board.create('segment', [C, B], { color: 'black' });
board.unsuspendUpdate();
var rol = board.createRoulette(bigCircle, circle, 0, Math.PI / 45, -1, 150, [C, P, B]);

Rolling circle on circle

This code creates a visual demonstration of a rolling circle (roulette) inside a larger circle. It first draws a large circle and then a smaller green circle whose radius is the distance between two points, P and C. A point B glides along the smaller circle, with a segment connecting C and B. Finally, the smaller circle rolls along the big circle, producing a roulette curve. **AI generated desctiption**
<input type="button" value="start" onclick="rol.start()">
<input type="button" value="stop" onclick="rol.stop()">
<input type="button" value="one step" onclick="rol.rolling()">
// Define the id of your board in BOARDID

var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-5, 5, 5, -5], keepaspectratio: true });
board.suspendUpdate();
// Big circle
var bigCircle = board.create('curve', [
            function(t) { return 4 * Math.cos(t); }, function(t) { return 4 * Math.sin(t); }, 0, 2 * Math.PI], { strokeWidth: 6 });
// Circle
var P = board.create('point', [4, 0], { name: 'P', trace: false });
var C = board.create('point', [2, 0], { name: 'C' });
var circle = board.create('curve', [
                    function(t) {
        var d = P.Dist(C),
            beta = JXG.Math.Geometry.rad([C.X() + 1, C.Y()], C, P);
        t += beta;
        return C.X() + d * Math.cos(t);
                    },
                    function(t) {
        var d = P.Dist(C),
            beta = JXG.Math.Geometry.rad([C.X() + 1, C.Y()], C, P);
        t += beta;
        return C.Y() + d * Math.sin(t);
                    },
                    0, 2 * Math.PI], { strokeWidth: 6, strokeColor: 'green' });

// Point on circle
var B = board.create('glider', [0, 2, circle], { name: 'B', color: 'blue', trace: false });
board.create('segment', [C, B], { color: 'black' });
board.unsuspendUpdate();
var rol = board.createRoulette(bigCircle, circle, 0, Math.PI / 45, -1, 150, [C, P, B]);

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.